Created
December 18, 2008 12:24
-
-
Save aurelian/37477 to your computer and use it in GitHub Desktop.
This file contains 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 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() |
This file contains 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
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