1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Fix 500 on some pages

This commit is contained in:
Steffo 2019-10-09 00:53:34 +02:00
parent 9bc92d7087
commit 22f5deb294
18 changed files with 19 additions and 19 deletions

View file

@ -1,4 +1,4 @@
from .royals import User from .users import User
from .telegram import Telegram from .telegram import Telegram
from .diario import Diario from .diario import Diario
from .aliases import Alias from .aliases import Alias

View file

@ -5,7 +5,7 @@ from sqlalchemy import Column, \
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.ext.declarative import declared_attr
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from .royals import User from .users import User
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from .keygroups import Keygroup from .keygroups import Keygroup

View file

@ -5,7 +5,7 @@ from sqlalchemy import Column, \
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.ext.declarative import declared_attr
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from .royals import User from .users import User
class Alias: class Alias:

View file

@ -4,7 +4,7 @@ from sqlalchemy import Column, \
ForeignKey ForeignKey
from sqlalchemy.orm import relationship, backref from sqlalchemy.orm import relationship, backref
from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.ext.declarative import declared_attr
from .royals import User from .users import User
class Bio: class Bio:

View file

@ -9,7 +9,7 @@ from sqlalchemy import Column, \
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.ext.declarative import declared_attr
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from .royals import User from .users import User
class Diario: class Diario:

View file

@ -6,7 +6,7 @@ from sqlalchemy import Column, \
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.ext.declarative import declared_attr
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from .royals import User from .users import User
class Discord: class Discord:

View file

@ -4,7 +4,7 @@ from sqlalchemy import Column, \
ForeignKey ForeignKey
from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
from .royals import User from .users import User
from .medals import Medal from .medals import Medal

View file

@ -4,7 +4,7 @@ from sqlalchemy import Column, \
ForeignKey ForeignKey
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.ext.declarative import declared_attr
from .royals import User from .users import User
from .mmevents import MMEvent from .mmevents import MMEvent

View file

@ -9,7 +9,7 @@ from sqlalchemy import Column, \
BigInteger BigInteger
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.ext.declarative import declared_attr
from .royals import User from .users import User
if typing.TYPE_CHECKING: if typing.TYPE_CHECKING:
from .mmdecisions import MMDecision from .mmdecisions import MMDecision
from .mmresponse import MMResponse from .mmresponse import MMResponse

View file

@ -4,7 +4,7 @@ from sqlalchemy import Column, \
ForeignKey ForeignKey
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.ext.declarative import declared_attr
from .royals import User from .users import User
from .mmevents import MMEvent from .mmevents import MMEvent

View file

@ -7,7 +7,7 @@ from sqlalchemy import Column, \
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.ext.declarative import declared_attr
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from .royals import User from .users import User
class Reminder: class Reminder:

View file

@ -6,7 +6,7 @@ from sqlalchemy import Column, \
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.ext.declarative import declared_attr
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from .royals import User from .users import User
class Telegram: class Telegram:

View file

@ -3,7 +3,7 @@ from sqlalchemy import Column, \
ForeignKey ForeignKey
from sqlalchemy.orm import relationship, backref from sqlalchemy.orm import relationship, backref
from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.ext.declarative import declared_attr
from .royals import User from .users import User
class TriviaScore: class TriviaScore:

View file

@ -9,7 +9,7 @@ from sqlalchemy.ext.declarative import declared_attr
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from .wikipages import WikiPage from .wikipages import WikiPage
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from .royals import User from .users import User
class WikiRevision: class WikiRevision:

View file

@ -25,7 +25,7 @@ def login_done():
fd = f.request.form fd = f.request.form
if "username" not in fd: if "username" not in fd:
return error(400, "Nessun username inserito.") 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: if royal_user is None:
return error(404, "L'username inserito non corrisponde a nessun account registrato.") return error(404, "L'username inserito non corrisponde a nessun account registrato.")
if "password" not in fd: if "password" not in fd:

View file

@ -23,7 +23,7 @@ def login_index():
return error(400, "Non è stato inserito nessun username.") return error(400, "Non è stato inserito nessun username.")
if "password" not in fd: if "password" not in fd:
return error(400, "Non è stata inserita nessuna password.") 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: if royal is not None:
return error(403, "Esiste già un utente con quell'username.") return error(403, "Esiste già un utente con quell'username.")
alias = alchemy_session.query(alchemy.Alias).filter_by(alias=fd["username"]).one_or_none() alias = alchemy_session.query(alchemy.Alias).filter_by(alias=fd["username"]).one_or_none()

View file

@ -18,14 +18,14 @@ rp = Royalprint("profile", __name__, url_prefix="/profile", template_folder=tmpl
@rp.route("/") @rp.route("/")
def profile_index(): def profile_index():
alchemy, alchemy_session = f.current_app.config["ALCHEMY"], f.current_app.config["ALCHEMY_SESSION"] 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) return f.render_template("profile_index.html", royals=royals)
@rp.route("/<username>") @rp.route("/<username>")
def profile_page(username): def profile_page(username):
alchemy, alchemy_session = f.current_app.config["ALCHEMY"], f.current_app.config["ALCHEMY_SESSION"] 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: if royal is None:
return error(404, "Non esiste nessun utente con l'username richiesto.") return error(404, "Non esiste nessun utente con l'username richiesto.")
if royal.bio is not None and royal.bio.contents != "": if royal.bio is not None and royal.bio.contents != "":
@ -43,7 +43,7 @@ def profile_editbio(username):
if "royal" not in f.session: if "royal" not in f.session:
return error(403, "Devi aver effettuato il login per modificare una bio.") 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"] 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"): 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.") return error(403, "Non sei autorizzato a modificare questa pagina bio.")