diff --git a/src/app.py b/src/app.py index 04aa588..1d7d1af 100644 --- a/src/app.py +++ b/src/app.py @@ -43,7 +43,6 @@ def index(): @app.route("/archive") def archive(): - entries = db.get_entries() content = con_gen.gen_arch_string() return render_template("archive.html", content_string=content) @@ -73,9 +72,9 @@ def feed(): @login.user_loader def load_user(ident): - db_user = db.get_user_by_id(ident) - if db_user is not None: - return db.db_to_user(*db_user) + user = db.get_user_by_id(ident) + if user is not None: + return user return None @@ -85,9 +84,9 @@ def login(): return redirect(url_for("index")) form = LoginForm() if form.validate_on_submit(): - db_user = db.get_user_by_name(form.username.data) - if db_user is not None: - user = db.db_to_user(*db_user) + user = db.get_user_by_name(form.username.data) + print(user) + if user is not None: if user.check_password(form.password.data): login_user(user) return redirect(url_for("index")) @@ -108,8 +107,8 @@ def register(): return redirect(url_for("index")) form = RegisterForm() if form.validate_on_submit(): - db_user = db.get_user_by_name(form.username.data) - if db_user is None: + user = db.get_user_by_name(form.username.data) + if user is None: user = User(form.username.data) user.set_password(form.password.data) ident = db.insert_user(user) diff --git a/src/content.py b/src/content.py index 51738cc..3e03e65 100644 --- a/src/content.py +++ b/src/content.py @@ -39,10 +39,10 @@ def gen_arch_string(): entries.reverse() for entry in entries: ident = entry[0] - title = entry[1] + title = db.get_item_by_id(entry[1])[1] year = entry[2] rating = entry[4] - username = db.get_user_by_id(entry[5])[1] + username = db.get_user_by_id(entry[5]).name if year != last_year: if last_year != "": content_string += "\n" @@ -76,10 +76,10 @@ def gen_user_string(name): entries.reverse() for entry in entries: ident = entry[0] - title = entry[1] + title = db.get_item_by_id(entry[1])[1] year = entry[2] rating = entry[4] - username = db.get_user_by_id(entry[5])[1] + username = db.get_user_by_id(entry[5]).name if year != last_year: if last_year != "": content_string += "\n" @@ -110,11 +110,11 @@ def gen_index_string(): entries.reverse() for entry in entries: ident = entry[0] - title = entry[1] + title = db.get_item_by_id(entry[1])[1] year = entry[2] text = entry[3] rating = entry[4] - username = db.get_user_by_id(entry[5])[1] + username = db.get_user_by_id(entry[5]).name reviewed = entry[6] content_string += "
\n" content_string += "