fix pylint and black
This commit is contained in:
@@ -51,7 +51,9 @@ def qmail_status(user):
|
|||||||
|
|
||||||
def check_user(user):
|
def check_user(user):
|
||||||
"""Check if user exists"""
|
"""Check if user exists"""
|
||||||
fulluser = [item for item in app.config.get("USERS") if item[1].split('@')[0] == user]
|
fulluser = [
|
||||||
|
item for item in app.config.get("USERS") if item[1].split("@")[0] == user
|
||||||
|
]
|
||||||
if not fulluser:
|
if not fulluser:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
@@ -123,6 +125,7 @@ def index():
|
|||||||
users=app.config.get("USERS"),
|
users=app.config.get("USERS"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/user/<user>")
|
@app.route("/user/<user>")
|
||||||
def user_status(user):
|
def user_status(user):
|
||||||
"""Status for specific user"""
|
"""Status for specific user"""
|
||||||
@@ -130,9 +133,7 @@ def user_status(user):
|
|||||||
if not check_user(user):
|
if not check_user(user):
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
with open(
|
with open(get_messagefile(user), "r", encoding="utf-8") as messagefile:
|
||||||
get_messagefile(user), "r", encoding="utf-8"
|
|
||||||
) as messagefile:
|
|
||||||
message = messagefile.read()
|
message = messagefile.read()
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
@@ -151,9 +152,7 @@ def user_update(user):
|
|||||||
|
|
||||||
if request.form["action"] == "message":
|
if request.form["action"] == "message":
|
||||||
input_message = request.form["message"]
|
input_message = request.form["message"]
|
||||||
with open(
|
with open(get_messagefile(user), "w", encoding="utf-8") as messagefile:
|
||||||
get_messagefile(user), "w", encoding="utf-8"
|
|
||||||
) as messagefile:
|
|
||||||
messagefile.write(str(input_message))
|
messagefile.write(str(input_message))
|
||||||
result = "Success: The autoreply message has been updated!"
|
result = "Success: The autoreply message has been updated!"
|
||||||
|
|
||||||
@@ -182,9 +181,12 @@ def user_update(user):
|
|||||||
try:
|
try:
|
||||||
return render_template("update.html", user=user, result=result)
|
return render_template("update.html", user=user, result=result)
|
||||||
except UnboundLocalError:
|
except UnboundLocalError:
|
||||||
return render_template("update.html", user=user, result="Something went terribly wrong!")
|
return render_template(
|
||||||
|
"update.html", user=user, result="Something went terribly wrong!"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.errorhandler(404)
|
@app.errorhandler(404)
|
||||||
def page_not_found(e):
|
def page_not_found(error):
|
||||||
return render_template('error.html', error=e), 404
|
"""Error for 404"""
|
||||||
|
return render_template("error.html", error=error), 404
|
||||||
|
|||||||
Reference in New Issue
Block a user