Mercurial > hg > CAPTCHAmiddleware
comparison captchamiddleware/example.py @ 2:c861518b2a44
fix bug whereby forbidden characters cause issues
| author | k0s <k0scist@gmail.com> |
|---|---|
| date | Tue, 23 Feb 2010 19:50:23 -0500 |
| parents | 21ec6325ae0e |
| children | ce757057961c |
comparison
equal
deleted
inserted
replaced
| 1:478d13061336 | 2:c861518b2a44 |
|---|---|
| 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><form method="post">Hello, world!<input type="submit"/></form></body></html>')(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) |
| 7 | 7 |
| 8 | 8 |
| 9 def factory(global_conf, **app_conf): | 9 def factory(global_conf, **app_conf): |
| 10 """create a webob view and wrap it in middleware""" | 10 """create a webob view and wrap it in middleware""" |
| 11 keystring = 'captcha.' | 11 keystring = 'captcha.' |
