New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solves the url redirect rule problem #51
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,10 @@ | |
WIKIPART = re.compile(r'([A-Z][a-z0-9_]+)') | ||
WIKIWORD = re.compile(r'([A-Z][a-z0-9_]+(?:[A-Z][a-z0-9_]+)+)') | ||
|
||
@app.route('/', methods=['GET']) | ||
def redirect(): | ||
return redirect(url_for('HomePage')) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll mess with it a little more extensively later tonight but that should be it. |
||
|
||
@app.template_filter() | ||
def totitle(value): | ||
return ' '.join(WIKIPART.findall(value)) | ||
|
@@ -22,14 +26,14 @@ def wikify(value): | |
parts[i] = '[%s](%s)' % (name, url_for('show_page', pagepath=part)) | ||
return markdown2.markdown(''.join(parts)) | ||
|
||
|
||
@app.route('/<path:pagepath>') | ||
def show_page(pagepath): | ||
page = mongo.db.pages.find_one_or_404({'_id': pagepath}) | ||
return render_template('page.html', | ||
page=page, | ||
pagepath=pagepath) | ||
|
||
app.add_url_rule('/', 'homepage_redirect', redirect_to='/HomePage') | ||
|
||
@app.route('/edit/<path:pagepath>', methods=['GET']) | ||
def edit_page(pagepath): | ||
|
@@ -67,9 +71,7 @@ def save_upload(filename): | |
return redirect(url_for('get_upload', filename=filename)) | ||
return render_template('upload.html', filename=filename) | ||
|
||
|
||
if __name__ == '__main__': | ||
import doctest | ||
doctest.testmod() | ||
app.run(debug=True) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will shadow "redirect" imported from flask module... should probably rename to
homepage_redirect
or something like that (that's what it was called before).