From 9dd41c468b3c81231e7b0f37201f8519148ec090 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 23 Aug 2008 01:11:23 +0000 Subject: Prevent usage of wsgiapp decorator from foiling actions pickling. Add Django attribution, contributors file. --- repoze/bfg/wsgi.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'repoze/bfg/wsgi.py') 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 -- cgit v1.2.3