Remove useless 'str(...)' usage

This commit is contained in:
Jan-Pieter Baert 2019-12-06 15:34:39 +01:00
parent 079357bb4e
commit a81055b574
No known key found for this signature in database
GPG key ID: B19186932178234A
2 changed files with 8 additions and 8 deletions

View file

@ -44,7 +44,7 @@ def css():
# Here seasonal themes will be returned; matching the current date. # Here seasonal themes will be returned; matching the current date.
# Open the YAML file with all the themes. # Open the YAML file with all the themes.
path = os.path.join(str(app.root_path), "views/themes.yml") path = os.path.join(app.root_path, "views/themes.yml")
with open(path, 'r') as stream: with open(path, 'r') as stream:
data = yaml.safe_load(stream) data = yaml.safe_load(stream)
# Build a dictionary from the YAML file with all the themes and there attributes. # Build a dictionary from the YAML file with all the themes and there attributes.
@ -81,13 +81,13 @@ def css():
if (((end_month == current_month) and if (((end_month == current_month) and
(end_day >= current_day)) or (end_day >= current_day)) or
(end_month > current_month)): (end_month > current_month)):
path = os.path.join(str(app.root_path), cssPath, theme['file']) path = os.path.join(app.root_path, cssPath, theme['file'])
break break
else: else:
if request.cookies['theme'] == 'darkmode' : if request.cookies['theme'] == 'darkmode' :
path = os.path.join(str(app.root_path), "static/css/themes/lowPerformance/darkmode.css") path = os.path.join(app.root_path, "static/css/themes/lowPerformance/darkmode.css")
else: else:
path = os.path.join(str(app.root_path), "static/css/themes/lowPerformance/lightmode.css") path = os.path.join(app.root_path, "static/css/themes/lowPerformance/lightmode.css")
# Tijdelijk ongebruikt tot bewezen dat het veilig is # Tijdelijk ongebruikt tot bewezen dat het veilig is
#try: #try:
@ -96,7 +96,7 @@ def css():
#except IOError: #except IOError:
# f = open(cssPath+"lightmode.css") # f = open(cssPath+"lightmode.css")
else: else:
path = os.path.join(str(app.root_path), "static/css/themes/lowPerformance/lightmode.css") path = os.path.join(app.root_path, "static/css/themes/lowPerformance/lightmode.css")
f = open(path) f = open(path)
response = make_response(f.read()) response = make_response(f.read())
response.headers['Content-Type'] = 'text/css' response.headers['Content-Type'] = 'text/css'
@ -146,13 +146,13 @@ def favicon() -> str:
# pylint: disable=R1705 # pylint: disable=R1705
if not get_orders((Order.stoptime > datetime.now())): if not get_orders((Order.stoptime > datetime.now())):
return send_from_directory( return send_from_directory(
os.path.join(str(app.root_path), "static"), os.path.join(app.root_path, "static"),
"favicon.ico", "favicon.ico",
mimetype="image/x-icon", mimetype="image/x-icon",
) )
else: else:
return send_from_directory( return send_from_directory(
os.path.join(str(app.root_path), "static"), os.path.join(app.root_path, "static"),
"favicon_orange.ico", "favicon_orange.ico",
mimetype="image/x-icon", mimetype="image/x-icon",
) )

View file

@ -31,7 +31,7 @@ def authorized() -> typing.Any:
request.args["error_description"], request.args["error_description"],
) )
if isinstance(resp, OAuthException): if isinstance(resp, OAuthException):
return "Access denied: %s" % resp.message + "<br>" + str(resp.data) return f"Access denied: {resp.message}<br>{resp.data}"
session["zeus_token"] = (resp["access_token"], "") session["zeus_token"] = (resp["access_token"], "")
me = current_app.zeus.get("current_user/") me = current_app.zeus.get("current_user/")