Permalink
Browse files

correct some routing mistakes in wiki example

  • Loading branch information...
1 parent 235af1c commit 5d6acc23b4e31f854a1d8c8e293d7c4b5e9806de @dcrosta committed Jun 19, 2012
Showing with 3 additions and 5 deletions.
  1. +3 −5 examples/wiki/wiki.py
View
8 examples/wiki/wiki.py
@@ -29,7 +29,7 @@ def show_page(pagepath):
page=page,
pagepath=pagepath)
-app.add_url_rule('/', 'homepage_redirect', redirect_to='/wiki/HomePage')
+app.add_url_rule('/', 'homepage_redirect', redirect_to='/HomePage')
@app.route('/edit/<path:pagepath>', methods=['GET'])
def edit_page(pagepath):
@@ -50,13 +50,11 @@ def save_page(pagepath):
@app.errorhandler(404)
def new_page(error):
pagepath = request.path.lstrip('/')
- if pagepath.startswith('wiki'):
- return render_template('edit.html', page=None, pagepath=pagepath)
- elif pagepath.startswith('uploads'):
+ if pagepath.startswith('uploads'):
filename = pagepath[len('uploads'):].lstrip('/')
return render_template('upload.html', filename=filename)
else:
- return render_template('404.html')
+ return render_template('edit.html', page=None, pagepath=pagepath)
@app.route('/uploads/<path:filename>')
def get_upload(filename):

0 comments on commit 5d6acc2

Please sign in to comment.