Skip to content
This repository has been archived by the owner on Oct 13, 2024. It is now read-only.

Commit

Permalink
fix(ui): return correct templates
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Dec 22, 2023
1 parent d459ad2 commit 4f843d2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Contents/Code/webapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@
database_cache_lock = Lock()


responses = {
500: Response(response='Internal Server Error', status=500, mimetype='text/plain')
}


@babel.localeselector
def get_locale():
# type: () -> str
Expand Down Expand Up @@ -387,16 +392,18 @@ def home():
--------
>>> home()
"""
items = []
if not os.path.isfile(database_cache_file):
return render_template('home_db_not_cached.html', title='Home')

Check warning on line 396 in Contents/Code/webapp.py

View check run for this annotation

Codecov / codecov/patch

Contents/Code/webapp.py#L396

Added line #L396 was not covered by tests

try:
items = json.loads(Core.storage.load(filename=database_cache_file, binary=False))
except IOError:
pass
return responses[500]

Check warning on line 401 in Contents/Code/webapp.py

View check run for this annotation

Codecov / codecov/patch

Contents/Code/webapp.py#L401

Added line #L401 was not covered by tests

if items:
return render_template('home.html', title='Home', items=items)
else:
return render_template('home_db_not_cached.html', title='Home')
return responses[500]

Check warning on line 406 in Contents/Code/webapp.py

View check run for this annotation

Codecov / codecov/patch

Contents/Code/webapp.py#L406

Added line #L406 was not covered by tests


@app.route("/<path:img>", methods=["GET"])
Expand Down

0 comments on commit 4f843d2

Please sign in to comment.