Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
process a form
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed Dec 19, 2014
1 parent 4a00673 commit b91867a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/ensae_teaching_cs/td_1a/simple_flask_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ def help_command(command):
return Text2Response("help for command: {0}".format(command))
except Exception as e :
return Exception2Response(e)

@app.route('/form/', methods=['POSTS'])
def form():
"""
process a form
"""
try:
rows= []
for k,v in request.form.to.dict().items():
rows.append ("{0}={1}".format(k,v) )
return Text2Response("\n".join(rows))
except Exception as e :
return Exception2Response(e)

@app.route('/')
def main_page():
Expand All @@ -52,6 +65,7 @@ def main_page():
/help/<command> help on command command
/upload/ upload a file (use post)
/shutdown/ shutdown the server (for unit test)
/form/ process a form
""".replace(" ","")
return Text2Response(message)

Expand Down

0 comments on commit b91867a

Please sign in to comment.