Skip to content

Commit

Permalink
#20: flask_form.py, add conditional POST / GET logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff1evesque committed Aug 26, 2014
1 parent ac1c7f2 commit 9a9c212
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/python/flask_form.py
Expand Up @@ -3,7 +3,7 @@

#!/usr/bin/python

from flask import Flask, request
from flask import Flask, request, redirect, url_for
app = Flask(__name__)

# debug options
Expand All @@ -13,9 +13,11 @@
# handles 'get', and 'post'
@app.route('/machine-learning/tests/python/flask_form.py', methods=['GET', 'POST'])
def parse_request():
temp = request.form['svm_session']
print temp
return temp
if request.method == 'POST':
temp = request.form['svm_session']
return temp
else:
return redirect(url_for('/machine-learning/tests/python/form.html'));

if __name__ == '__main__':
app.run()

0 comments on commit 9a9c212

Please sign in to comment.