Skip to content

Instantly share code, notes, and snippets.

@masazdream
Created May 24, 2014 06:10
Show Gist options
  • Save masazdream/1bc0412c7840951da2eb to your computer and use it in GitHub Desktop.
Save masazdream/1bc0412c7840951da2eb to your computer and use it in GitHub Desktop.
#coding: UTF-8
'''
Created on 2014/05/24
@author: masahiro
'''
import cgi
from google.appengine.api import users
import webapp2
MAIN_PAGE_HTML = """\
<html>
<body>
<form action="/sign" method="post">
<div><textarea name="content" rows="3" cols="60"></textarea></div>
<div><input type="submit" value="何か書いてください。"></div>
</form>
</body>
</html>
"""
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.write(MAIN_PAGE_HTML)
class Guestbook(webapp2.RequestHandler):
def post(self):
self.response.write('<html><body>あたなの文章:<pre>')
self.response.write(cgi.escape(self.request.get('content')))
self.response.write('</pre></body></html>')
application = webapp2.WSGIApplication([
('/', MainPage),
('/sign', Guestbook),
], debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment