From 22f5deb294d617610eeb8848697537a29ef3a7e8 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 9 Oct 2019 00:53:34 +0200 Subject: [PATCH] Fix 500 on some pages --- royalnet/database/tables/__init__.py | 2 +- royalnet/database/tables/activekvgroups.py | 2 +- royalnet/database/tables/aliases.py | 2 +- royalnet/database/tables/bios.py | 2 +- royalnet/database/tables/diario.py | 2 +- royalnet/database/tables/discord.py | 2 +- royalnet/database/tables/medalawards.py | 2 +- royalnet/database/tables/mmdecisions.py | 2 +- royalnet/database/tables/mmevents.py | 2 +- royalnet/database/tables/mmresponse.py | 2 +- royalnet/database/tables/reminders.py | 2 +- royalnet/database/tables/telegram.py | 2 +- royalnet/database/tables/triviascores.py | 2 +- royalnet/database/tables/{royals.py => users.py} | 0 royalnet/database/tables/wikirevisions.py | 2 +- royalnet/web/royalprints/login/__init__.py | 2 +- royalnet/web/royalprints/newaccount/__init__.py | 2 +- royalnet/web/royalprints/profile/__init__.py | 6 +++--- 18 files changed, 19 insertions(+), 19 deletions(-) rename royalnet/database/tables/{royals.py => users.py} (100%) diff --git a/royalnet/database/tables/__init__.py b/royalnet/database/tables/__init__.py index de1a083d..9b6953d2 100644 --- a/royalnet/database/tables/__init__.py +++ b/royalnet/database/tables/__init__.py @@ -1,4 +1,4 @@ -from .royals import User +from .users import User from .telegram import Telegram from .diario import Diario from .aliases import Alias diff --git a/royalnet/database/tables/activekvgroups.py b/royalnet/database/tables/activekvgroups.py index 429003c2..168d8284 100644 --- a/royalnet/database/tables/activekvgroups.py +++ b/royalnet/database/tables/activekvgroups.py @@ -5,7 +5,7 @@ from sqlalchemy import Column, \ from sqlalchemy.orm import relationship from sqlalchemy.ext.declarative import declared_attr # noinspection PyUnresolvedReferences -from .royals import User +from .users import User # noinspection PyUnresolvedReferences from .keygroups import Keygroup diff --git a/royalnet/database/tables/aliases.py b/royalnet/database/tables/aliases.py index afccf47f..77815149 100644 --- a/royalnet/database/tables/aliases.py +++ b/royalnet/database/tables/aliases.py @@ -5,7 +5,7 @@ from sqlalchemy import Column, \ from sqlalchemy.orm import relationship from sqlalchemy.ext.declarative import declared_attr # noinspection PyUnresolvedReferences -from .royals import User +from .users import User class Alias: diff --git a/royalnet/database/tables/bios.py b/royalnet/database/tables/bios.py index 64ac8506..2703095b 100644 --- a/royalnet/database/tables/bios.py +++ b/royalnet/database/tables/bios.py @@ -4,7 +4,7 @@ from sqlalchemy import Column, \ ForeignKey from sqlalchemy.orm import relationship, backref from sqlalchemy.ext.declarative import declared_attr -from .royals import User +from .users import User class Bio: diff --git a/royalnet/database/tables/diario.py b/royalnet/database/tables/diario.py index 060489fd..dc10fd83 100644 --- a/royalnet/database/tables/diario.py +++ b/royalnet/database/tables/diario.py @@ -9,7 +9,7 @@ from sqlalchemy import Column, \ from sqlalchemy.orm import relationship from sqlalchemy.ext.declarative import declared_attr # noinspection PyUnresolvedReferences -from .royals import User +from .users import User class Diario: diff --git a/royalnet/database/tables/discord.py b/royalnet/database/tables/discord.py index da2d25f9..2de86e7a 100644 --- a/royalnet/database/tables/discord.py +++ b/royalnet/database/tables/discord.py @@ -6,7 +6,7 @@ from sqlalchemy import Column, \ from sqlalchemy.orm import relationship from sqlalchemy.ext.declarative import declared_attr # noinspection PyUnresolvedReferences -from .royals import User +from .users import User class Discord: diff --git a/royalnet/database/tables/medalawards.py b/royalnet/database/tables/medalawards.py index 6e54abfd..6426705d 100644 --- a/royalnet/database/tables/medalawards.py +++ b/royalnet/database/tables/medalawards.py @@ -4,7 +4,7 @@ from sqlalchemy import Column, \ ForeignKey from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.orm import relationship -from .royals import User +from .users import User from .medals import Medal diff --git a/royalnet/database/tables/mmdecisions.py b/royalnet/database/tables/mmdecisions.py index 3e2bdc8c..b67f32b7 100644 --- a/royalnet/database/tables/mmdecisions.py +++ b/royalnet/database/tables/mmdecisions.py @@ -4,7 +4,7 @@ from sqlalchemy import Column, \ ForeignKey from sqlalchemy.orm import relationship from sqlalchemy.ext.declarative import declared_attr -from .royals import User +from .users import User from .mmevents import MMEvent diff --git a/royalnet/database/tables/mmevents.py b/royalnet/database/tables/mmevents.py index 774f9242..7d414a3b 100644 --- a/royalnet/database/tables/mmevents.py +++ b/royalnet/database/tables/mmevents.py @@ -9,7 +9,7 @@ from sqlalchemy import Column, \ BigInteger from sqlalchemy.orm import relationship from sqlalchemy.ext.declarative import declared_attr -from .royals import User +from .users import User if typing.TYPE_CHECKING: from .mmdecisions import MMDecision from .mmresponse import MMResponse diff --git a/royalnet/database/tables/mmresponse.py b/royalnet/database/tables/mmresponse.py index a6643586..dc119be8 100644 --- a/royalnet/database/tables/mmresponse.py +++ b/royalnet/database/tables/mmresponse.py @@ -4,7 +4,7 @@ from sqlalchemy import Column, \ ForeignKey from sqlalchemy.orm import relationship from sqlalchemy.ext.declarative import declared_attr -from .royals import User +from .users import User from .mmevents import MMEvent diff --git a/royalnet/database/tables/reminders.py b/royalnet/database/tables/reminders.py index 31a36db3..4a983776 100644 --- a/royalnet/database/tables/reminders.py +++ b/royalnet/database/tables/reminders.py @@ -7,7 +7,7 @@ from sqlalchemy import Column, \ from sqlalchemy.orm import relationship from sqlalchemy.ext.declarative import declared_attr # noinspection PyUnresolvedReferences -from .royals import User +from .users import User class Reminder: diff --git a/royalnet/database/tables/telegram.py b/royalnet/database/tables/telegram.py index 5f922659..d3798f6e 100644 --- a/royalnet/database/tables/telegram.py +++ b/royalnet/database/tables/telegram.py @@ -6,7 +6,7 @@ from sqlalchemy import Column, \ from sqlalchemy.orm import relationship from sqlalchemy.ext.declarative import declared_attr # noinspection PyUnresolvedReferences -from .royals import User +from .users import User class Telegram: diff --git a/royalnet/database/tables/triviascores.py b/royalnet/database/tables/triviascores.py index 35f00129..f9a761b5 100644 --- a/royalnet/database/tables/triviascores.py +++ b/royalnet/database/tables/triviascores.py @@ -3,7 +3,7 @@ from sqlalchemy import Column, \ ForeignKey from sqlalchemy.orm import relationship, backref from sqlalchemy.ext.declarative import declared_attr -from .royals import User +from .users import User class TriviaScore: diff --git a/royalnet/database/tables/royals.py b/royalnet/database/tables/users.py similarity index 100% rename from royalnet/database/tables/royals.py rename to royalnet/database/tables/users.py diff --git a/royalnet/database/tables/wikirevisions.py b/royalnet/database/tables/wikirevisions.py index 8713876e..fd21b55c 100644 --- a/royalnet/database/tables/wikirevisions.py +++ b/royalnet/database/tables/wikirevisions.py @@ -9,7 +9,7 @@ from sqlalchemy.ext.declarative import declared_attr # noinspection PyUnresolvedReferences from .wikipages import WikiPage # noinspection PyUnresolvedReferences -from .royals import User +from .users import User class WikiRevision: diff --git a/royalnet/web/royalprints/login/__init__.py b/royalnet/web/royalprints/login/__init__.py index a270361a..ab09dfd8 100644 --- a/royalnet/web/royalprints/login/__init__.py +++ b/royalnet/web/royalprints/login/__init__.py @@ -25,7 +25,7 @@ def login_done(): fd = f.request.form if "username" not in fd: return error(400, "Nessun username inserito.") - royal_user = alchemy_session.query(alchemy.Royal).filter_by(username=fd["username"]).one_or_none() + royal_user = alchemy_session.query(alchemy.User).filter_by(username=fd["username"]).one_or_none() if royal_user is None: return error(404, "L'username inserito non corrisponde a nessun account registrato.") if "password" not in fd: diff --git a/royalnet/web/royalprints/newaccount/__init__.py b/royalnet/web/royalprints/newaccount/__init__.py index e7b08cc6..1d1a7eda 100644 --- a/royalnet/web/royalprints/newaccount/__init__.py +++ b/royalnet/web/royalprints/newaccount/__init__.py @@ -23,7 +23,7 @@ def login_index(): return error(400, "Non è stato inserito nessun username.") if "password" not in fd: return error(400, "Non è stata inserita nessuna password.") - royal = alchemy_session.query(alchemy.Royal).filter_by(username=fd["username"]).one_or_none() + royal = alchemy_session.query(alchemy.User).filter_by(username=fd["username"]).one_or_none() if royal is not None: return error(403, "Esiste già un utente con quell'username.") alias = alchemy_session.query(alchemy.Alias).filter_by(alias=fd["username"]).one_or_none() diff --git a/royalnet/web/royalprints/profile/__init__.py b/royalnet/web/royalprints/profile/__init__.py index 7ff02eed..08a3858a 100644 --- a/royalnet/web/royalprints/profile/__init__.py +++ b/royalnet/web/royalprints/profile/__init__.py @@ -18,14 +18,14 @@ rp = Royalprint("profile", __name__, url_prefix="/profile", template_folder=tmpl @rp.route("/") def profile_index(): alchemy, alchemy_session = f.current_app.config["ALCHEMY"], f.current_app.config["ALCHEMY_SESSION"] - royals = alchemy_session.query(alchemy.Royal).order_by(alchemy.Royal.username).all() + royals = alchemy_session.query(alchemy.User).order_by(alchemy.User.username).all() return f.render_template("profile_index.html", royals=royals) @rp.route("/") def profile_page(username): alchemy, alchemy_session = f.current_app.config["ALCHEMY"], f.current_app.config["ALCHEMY_SESSION"] - royal = alchemy_session.query(alchemy.Royal).filter_by(username=username).one_or_none() + royal = alchemy_session.query(alchemy.User).filter_by(username=username).one_or_none() if royal is None: return error(404, "Non esiste nessun utente con l'username richiesto.") if royal.bio is not None and royal.bio.contents != "": @@ -43,7 +43,7 @@ def profile_editbio(username): if "royal" not in f.session: return error(403, "Devi aver effettuato il login per modificare una bio.") alchemy, alchemy_session = f.current_app.config["ALCHEMY"], f.current_app.config["ALCHEMY_SESSION"] - royal = alchemy_session.query(alchemy.Royal).filter_by(username=username).one_or_none() + royal = alchemy_session.query(alchemy.User).filter_by(username=username).one_or_none() if not (f.session["royal"]["uid"] == royal.uid or f.session["royal"]["role"] == "Admin"): return error(403, "Non sei autorizzato a modificare questa pagina bio.")