diff --git a/db.py b/db.py
index 73023507..7e897269 100644
--- a/db.py
+++ b/db.py
@@ -139,7 +139,7 @@ class Royal(Base, Mini):
if self.email is None:
return f"https://www.gravatar.com/avatar/{libgravatar.md5_hash(self.username)}?d=identicon&f=y"
gravatar = libgravatar.Gravatar(self.email)
- return gravatar.get_image(default="identicon")
+ return gravatar.get_image(default="identicon", use_ssl=True)
@classmethod
def mini_get_single_from_royal(cls, session: Session, royal: "Royal"):
diff --git a/templates/base.html b/templates/base.html
index 3609c711..740b1d72 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -23,7 +23,7 @@
DEBUG MODE
{% endif %}
- {% if g.user is not none %}
+ {% if g.user %}
{{ g.user.username }}
Logout
diff --git a/webserver.py b/webserver.py
index fe884e77..30d84e7d 100644
--- a/webserver.py
+++ b/webserver.py
@@ -1,4 +1,3 @@
-import secrets
from flask import Flask, render_template, request, abort, redirect, url_for, Markup, escape, jsonify
from flask import session as fl_session
from flask import g as fl_g
@@ -9,6 +8,7 @@ import markdown2
import datetime
# noinspection PyPackageRequirements
import telegram
+import errors
import query_discord_music
import random
import re
@@ -115,9 +115,14 @@ def page_profile(name: str):
css = fl_g.session.query(db.ProfileData).filter_by(royal=user).one_or_none()
mini_data = []
for game in db.mini_list:
- data = game.mini_get_single_from_royal(fl_g.session, user)
+ try:
+ data = game.mini_get_single_from_royal(fl_g.session, user)
+ except errors.NotFoundError():
+ data = None
# TODO: investigate on why instrumentedlists are returned
- if isinstance(data, InstrumentedList):
+ if data is None:
+ continue
+ elif isinstance(data, InstrumentedList):
mini_data.append({
"name": game._mini_name,
"data": data[0]
@@ -367,7 +372,7 @@ def pre_request():
fl_g.css = "nryg.less"
fl_g.rygconf = config
fl_g.session = db.Session()
- if fl_session is None:
+ if fl_session:
fl_g.user = None
else:
fl_g.user = fl_g.session.query(db.Royal).filter_by(id=fl_session["user_id"]).one_or_none()