Created
April 19, 2011 21:14
-
-
Save joshourisman/929684 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "base.html" %} | |
{% block content %} | |
<form method="POST" action="{{ dest }}"> | |
<input type="hidden" name="confirm" value="no" /> | |
<input type="submit" value="No" /> | |
</form> | |
<form method="POST" action="{{ dest }}"> | |
<input type="hidden" name="confirm" value="yes" /> | |
<input type="submit" value="Yes" /> | |
</form> | |
{% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def confirm(f): | |
@wraps(f) | |
def decorated(*args, **kwargs): | |
if 'confirm' not in request.form: | |
dest = request.url | |
context = {'dest': dest} | |
return render_template('confirm.html', **context) | |
if request.form['confirm'] != 'yes': | |
return redirect(url_for('list_galleries')) | |
return f(*args, **kwargs) | |
return decorated |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment