]> WPIA git - motion.git/commitdiff
chg: return relative redirects
authorFelix Dörre <felix@dogcraft.de>
Fri, 24 Nov 2017 18:23:39 +0000 (19:23 +0100)
committerFelix Dörre <felix@dogcraft.de>
Fri, 24 Nov 2017 18:23:39 +0000 (19:23 +0100)
motion.py

index cef02eeac3b07e14438ac920ea9bc376c9b996b8..957bf96f9ff8a96bd8bcbb4039ddf314462ccd6a 100644 (file)
--- a/motion.py
+++ b/motion.py
@@ -106,6 +106,11 @@ def main():
     return render_template('index.html', motions=rv[:10], more=rv[10]["id"] if len(rv) == 11 else None, times=times, prev=prev,
                            categories=get_allowed_cats("create"))
 
+def rel_redirect(loc):
+    r = redirect(loc)
+    r.autocorrect_location_header = False
+    return r
+
 @app.route("/motion", methods=['POST'])
 def put_motion():
     cat=request.form.get("category", "")
@@ -116,10 +121,10 @@ def put_motion():
         return "Error, invalid length", 500
     p = get_db().prepare("INSERT INTO motion(\"name\", \"content\", \"deadline\", \"posed_by\", \"type\") VALUES($1, $2, CURRENT_TIMESTAMP + $3 * interval '1 days', $4, $5)")
     p(request.form.get("title", ""), request.form.get("content",""), time, g.voter, cat)
-    return redirect("/")
+    return rel_redirect("/")
 
 def motion_edited(motion):
-    return redirect("/?start=" + str(motion) + "#motion-" + str(motion))
+    return rel_redirect("/?start=" + str(motion) + "#motion-" + str(motion))
 
 @app.route("/motion/<int:motion>/cancel", methods=['POST'])
 def cancel_motion(motion):