From 45f33971edcc2c21c9b56e324fb244c00858f77f Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Wed, 24 Jan 2018 06:03:31 +0000 Subject: [PATCH] Fix integer issues for custom css not creating --- webapp/titanembeds/blueprints/admin/admin.py | 1 + webapp/titanembeds/blueprints/user/user.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/webapp/titanembeds/blueprints/admin/admin.py b/webapp/titanembeds/blueprints/admin/admin.py index deb8543..769d7a9 100644 --- a/webapp/titanembeds/blueprints/admin/admin.py +++ b/webapp/titanembeds/blueprints/admin/admin.py @@ -373,4 +373,5 @@ def new_custom_css_post(): css = None css = UserCSS(name, user_id, variables_enabled, variables, css) db.session.add(css) + db.session.commit() return jsonify({"id": css.id}) \ No newline at end of file diff --git a/webapp/titanembeds/blueprints/user/user.py b/webapp/titanembeds/blueprints/user/user.py index 1b1e97c..3347dc9 100644 --- a/webapp/titanembeds/blueprints/user/user.py +++ b/webapp/titanembeds/blueprints/user/user.py @@ -119,6 +119,7 @@ def new_custom_css_post(): css = None css = UserCSS(name, user_id, variables_enabled, variables, css) db.session.add(css) + db.session.commit() return jsonify({"id": css.id}) @user.route("/custom_css/edit/", methods=["GET"]) @@ -130,7 +131,7 @@ def edit_custom_css_get(css_id): css = db.session.query(UserCSS).filter(UserCSS.id == css_id).first() if not css: abort(404) - if css.user_id != session['user_id']: + if str(css.user_id) != str(session['user_id']): abort(403) variables = css.css_variables if variables: