diff example/persona.py @ 30:0bf52646061b

example/persona.html example/persona.py setup.py
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 27 Dec 2013 11:24:23 -0800
parents b411066b4929
children 6af220013aa1
line wrap: on
line diff
--- a/example/persona.py	Thu Dec 26 23:44:43 2013 -0800
+++ b/example/persona.py	Fri Dec 27 11:24:23 2013 -0800
@@ -20,9 +20,14 @@
         assert os.path.exists(self.page), "File '%s' not found" % self.page
         self.page = open(self.page, 'r').read()
     def __call__(self, environ, start_response):
-        start_response("200 OK", [('Content-Type', 'text/html'),
-                                  ('Content-Length', str(len(self.page)))])
-        return [self.page]
+        method = environ['REQUEST_METHOD']
+        if method == 'GET':
+            start_response("200 OK", [('Content-Type', 'text/html'),
+                                      ('Content-Length', str(len(self.page)))])
+            body = self.page
+        elif method == 'POST':
+            body = '\n'.join([])
+        return [body]
 
 def main(args=sys.argv[1:]):