Created
January 3, 2012 19:03
-
-
Save navinpai/1556353 to your computer and use it in GitHub Desktop.
Form Processing with Flask
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
| #From http://flask.pocoo.org/docs/quickstart/ | |
| from flask import request | |
| @app.route('/login', methods=['POST', 'GET']) | |
| def login(): | |
| error = None | |
| if request.method == 'POST': | |
| if valid_login(request.form['username'], | |
| request.form['password']): | |
| return log_the_user_in(request.form['username']) | |
| else: | |
| error = 'Invalid username/password' | |
| # this is executed if the request method was GET or the | |
| # credentials were invalid | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment