Commits

Anonymous committed 6f45378

normalize url to have trailing slash always

  • Participants
  • Parent commits 558c124

Comments (0)

Files changed (1)

File flaskrest.py

     return redirect(url_for("page", title='StartPage'))
 
 
-@app.route('/save/<path:title>', methods=['POST'])
+@app.route('/save/<path:title>/', methods=['POST'])
 def save(title):
     print request.method, request.args
     g.db.execute(
     return redirect(url_for("page", title=title))
 
 
-@app.route('/edit/<path:title>', methods=['GET', 'POST'])
+@app.route('/edit/<path:title>/', methods=['GET', 'POST'])
 def edit(title):
     body = g.db.execute('select body from pages where title = ?',
                         [title]).fetchone()
                            title=title,
                            text=body[0] if body else '')
 
-@app.route('/page/<path:title>')
+@app.route('/page/<path:title>/')
 def page(title):
-    if title.endswith('/'):
-        return redirect(url_for('page', title=title[:-1]))
-
     body = g.db.execute('select body from pages where title = ?',
                         [title]).fetchone()
     if body: