diff options
| author | Chris McDonough <chrism@agendaless.com> | 2008-08-23 01:11:23 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2008-08-23 01:11:23 +0000 |
| commit | 9dd41c468b3c81231e7b0f37201f8519148ec090 (patch) | |
| tree | fc7dae098fd99d8d117887f740c6e931934e0681 /repoze/bfg/wsgi.py | |
| parent | 434c0514dc7dd9c7881e1d30db4d988680220af2 (diff) | |
| download | pyramid-9dd41c468b3c81231e7b0f37201f8519148ec090.tar.gz pyramid-9dd41c468b3c81231e7b0f37201f8519148ec090.tar.bz2 pyramid-9dd41c468b3c81231e7b0f37201f8519148ec090.zip | |
Prevent usage of wsgiapp decorator from foiling actions pickling.
Add Django attribution, contributors file.
Diffstat (limited to 'repoze/bfg/wsgi.py')
| -rw-r--r-- | repoze/bfg/wsgi.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/repoze/bfg/wsgi.py b/repoze/bfg/wsgi.py index 4efe40afc..2a23fe7aa 100644 --- a/repoze/bfg/wsgi.py +++ b/repoze/bfg/wsgi.py @@ -1,4 +1,9 @@ from webob import Response +try: + from functools import wraps +except ImportError: + # < 2.5 + from repoze.bfg.functional import wraps def wsgiapp(wrapped): """ Decorator to turn a WSGI application into a repoze.bfg view callable. @@ -24,7 +29,7 @@ def wsgiapp(wrapped): application to a Response and return it to repoze.bfg as if the WSGI app were a repoze.bfg view. """ - def _curried(context, request): + def decorator(context, request): caught = [] def catch_start_response(status, headers, exc_info=None): caught[:] = (status, headers, exc_info) @@ -39,6 +44,5 @@ def wsgiapp(wrapped): return response else: raise RuntimeError('WSGI start_response not called') - _curried.__name__ = wrapped.__name__ - return _curried + return wraps(wrapped)(decorator) # for pickleability |
