Skip to content

Instantly share code, notes, and snippets.

@aurelian
Created December 18, 2008 12:24
Show Gist options
  • Save aurelian/37477 to your computer and use it in GitHub Desktop.
Save aurelian/37477 to your computer and use it in GitHub Desktop.
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
class MainPage(webapp.RequestHandler):
def get(self):
self.response.out.write("""
<html>
<body>
<form action="/q1.html" method="post">
<div>Title: <input type="text" name="article[title]" /></div>
<div>Body:<br /><textarea name="article[content]" rows="3" cols="60"></textarea></div>
<div><input type="submit" value="Publish"></div>
</form>
</body>
</html>""")
def post(self):
article= self.request.get('article')
self.response.out.write( article['title'] )
application = webapp.WSGIApplication([('/q1.html', MainPage)], debug=True)
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()
Traceback (most recent call last):
File "/Projects/google_appengine/google/appengine/ext/webapp/__init__.py", line 501, in __call__
handler.post(*groups)
File "/Projects/google_appengine/lametext/q1.py", line 21, in post
self.response.out.write( article['title'] )
TypeError: string indices must be integers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment