comparison captchamiddleware/example.py @ 4:ce757057961c

flow contol now works; bumping version
author k0s <k0scist@gmail.com>
date Wed, 24 Feb 2010 20:11:25 -0500
parents c861518b2a44
children
comparison
equal deleted inserted replaced
3:b0ef5452a740 4:ce757057961c
1 from webob import Response 1 from webob import Response
2 from captchamiddleware import CAPTCHAmiddleware 2 from captchamiddleware import CAPTCHAmiddleware
3 from paste.httpexceptions import HTTPExceptionHandler 3 from paste.httpexceptions import HTTPExceptionHandler
4 4
5 def example_app(environ, start_response): 5 def example_app(environ, start_response):
6 return Response('<html><body><p>method=%s</p><form method="post">Hello, world!<input type="submit"/></form></body></html>' % environ['REQUEST_METHOD'])(environ, start_response) 6 method = environ['REQUEST_METHOD']
7 form = ''
8 if method != 'POST':
9 form = '<form method="post">Hello, world!<input type="submit"/></form>'
10
11 return Response('<html><body><p>method=%s</p>%s</body></html>' % (method, form))(environ, start_response)
7 12
8 13
9 def factory(global_conf, **app_conf): 14 def factory(global_conf, **app_conf):
10 """create a webob view and wrap it in middleware""" 15 """create a webob view and wrap it in middleware"""
11 keystring = 'captcha.' 16 keystring = 'captcha.'