Author: kmtracey
Date: 2010-03-13 18:17:37 -0600 (Sat, 13 Mar 2010)
New Revision: 12776

Modified:
   django/branches/releases/1.1.X/django/utils/decorators.py
   django/branches/releases/1.1.X/django/views/decorators/cache.py
   django/branches/releases/1.1.X/django/views/decorators/http.py
   django/branches/releases/1.1.X/django/views/decorators/vary.py
   django/branches/releases/1.1.X/tests/regressiontests/utils/decorators.py
   django/branches/releases/1.1.X/tests/regressiontests/utils/urls.py
   django/branches/releases/1.1.X/tests/regressiontests/utils/views.py
Log:
[1.1.X] Revert r12763 until we figure out what's wrong with it on 1.1.X. Refs 
#13111.


Modified: django/branches/releases/1.1.X/django/utils/decorators.py
===================================================================
--- django/branches/releases/1.1.X/django/utils/decorators.py   2010-03-13 
22:15:09 UTC (rev 12775)
+++ django/branches/releases/1.1.X/django/utils/decorators.py   2010-03-14 
00:17:37 UTC (rev 12776)
@@ -2,17 +2,10 @@
 
 import types
 try:
-    from functools import wraps, WRAPPER_ASSIGNMENTS
+    from functools import wraps
 except ImportError:
-    from django.utils.functional import wraps, WRAPPER_ASSIGNMENTS  # Python 
2.3, 2.4 fallback.
+    from django.utils.functional import wraps  # Python 2.3, 2.4 fallback.
 
-def available_attrs(fn):
-    """
-    Return the list of functools-wrappable attributes on a callable.
-    This is required as a workaround for http://bugs.python.org/issue3445.
-    """
-    return tuple(a for a in WRAPPER_ASSIGNMENTS if hasattr(fn, a))
-
 def decorator_from_middleware(middleware_class):
     """
     Given a middleware class (not an instance), returns a view decorator. This
@@ -64,5 +57,5 @@
                 if result is not None:
                     return result
             return response
-        return wraps(view_func, 
assigned=available_attrs(view_func))(_wrapped_view)
+        return wraps(view_func)(_wrapped_view)
     return _decorator_from_middleware

Modified: django/branches/releases/1.1.X/django/views/decorators/cache.py
===================================================================
--- django/branches/releases/1.1.X/django/views/decorators/cache.py     
2010-03-13 22:15:09 UTC (rev 12775)
+++ django/branches/releases/1.1.X/django/views/decorators/cache.py     
2010-03-14 00:17:37 UTC (rev 12776)
@@ -16,7 +16,7 @@
 except ImportError:
     from django.utils.functional import wraps  # Python 2.3, 2.4 fallback.
 
-from django.utils.decorators import decorator_from_middleware, available_attrs
+from django.utils.decorators import decorator_from_middleware
 from django.utils.cache import patch_cache_control, add_never_cache_headers
 from django.middleware.cache import CacheMiddleware
 
@@ -31,7 +31,7 @@
             patch_cache_control(response, **kwargs)
             return response
 
-        return wraps(viewfunc, 
assigned=available_attrs(viewfunc))(_cache_controlled)
+        return wraps(viewfunc)(_cache_controlled)
 
     return _cache_controller
 
@@ -44,4 +44,4 @@
         response = view_func(request, *args, **kwargs)
         add_never_cache_headers(response)
         return response
-    return wraps(view_func, 
assigned=available_attrs(view_func))(_wrapped_view_func)
+    return wraps(view_func)(_wrapped_view_func)

Modified: django/branches/releases/1.1.X/django/views/decorators/http.py
===================================================================
--- django/branches/releases/1.1.X/django/views/decorators/http.py      
2010-03-13 22:15:09 UTC (rev 12775)
+++ django/branches/releases/1.1.X/django/views/decorators/http.py      
2010-03-14 00:17:37 UTC (rev 12776)
@@ -11,7 +11,7 @@
 from datetime import timedelta
 from email.Utils import formatdate
 
-from django.utils.decorators import decorator_from_middleware, available_attrs
+from django.utils.decorators import decorator_from_middleware
 from django.utils.http import parse_etags, quote_etag
 from django.middleware.http import ConditionalGetMiddleware
 from django.http import HttpResponseNotAllowed, HttpResponseNotModified, 
HttpResponse
@@ -35,7 +35,7 @@
             if request.method not in request_method_list:
                 return HttpResponseNotAllowed(request_method_list)
             return func(request, *args, **kwargs)
-        return wraps(func, assigned=available_attrs(func))(inner)
+        return wraps(func)(inner)
     return decorator
 
 require_GET = require_http_methods(["GET"])

Modified: django/branches/releases/1.1.X/django/views/decorators/vary.py
===================================================================
--- django/branches/releases/1.1.X/django/views/decorators/vary.py      
2010-03-13 22:15:09 UTC (rev 12775)
+++ django/branches/releases/1.1.X/django/views/decorators/vary.py      
2010-03-14 00:17:37 UTC (rev 12776)
@@ -4,7 +4,6 @@
     from django.utils.functional import wraps  # Python 2.3, 2.4 fallback.
 
 from django.utils.cache import patch_vary_headers
-from django.utils.decorators import available_attrs
 
 def vary_on_headers(*headers):
     """
@@ -22,7 +21,7 @@
             response = func(*args, **kwargs)
             patch_vary_headers(response, headers)
             return response
-        return wraps(func, assigned=available_attrs(func))(inner_func)
+        return wraps(func)(inner_func)
     return decorator
 
 def vary_on_cookie(func):
@@ -38,4 +37,4 @@
         response = func(*args, **kwargs)
         patch_vary_headers(response, ('Cookie',))
         return response
-    return wraps(func, assigned=available_attrs(func))(inner_func)
+    return wraps(func)(inner_func)

Modified: 
django/branches/releases/1.1.X/tests/regressiontests/utils/decorators.py
===================================================================
--- django/branches/releases/1.1.X/tests/regressiontests/utils/decorators.py    
2010-03-13 22:15:09 UTC (rev 12775)
+++ django/branches/releases/1.1.X/tests/regressiontests/utils/decorators.py    
2010-03-14 00:17:37 UTC (rev 12776)
@@ -11,9 +11,3 @@
         Test a middleware that implements process_view.
         """
         self.client.get('/utils/xview/')
-
-    def test_callable_process_view_middleware(self):
-        """
-        Test a middleware that implements process_view, operating on a 
callable class.
-        """
-        self.client.get('/utils/class_xview/')

Modified: django/branches/releases/1.1.X/tests/regressiontests/utils/urls.py
===================================================================
--- django/branches/releases/1.1.X/tests/regressiontests/utils/urls.py  
2010-03-13 22:15:09 UTC (rev 12775)
+++ django/branches/releases/1.1.X/tests/regressiontests/utils/urls.py  
2010-03-14 00:17:37 UTC (rev 12776)
@@ -4,5 +4,4 @@
 
 urlpatterns = patterns('',
     (r'^xview/$', views.xview),
-    (r'^class_xview/$', views.class_xview),
 )

Modified: django/branches/releases/1.1.X/tests/regressiontests/utils/views.py
===================================================================
--- django/branches/releases/1.1.X/tests/regressiontests/utils/views.py 
2010-03-13 22:15:09 UTC (rev 12775)
+++ django/branches/releases/1.1.X/tests/regressiontests/utils/views.py 
2010-03-14 00:17:37 UTC (rev 12776)
@@ -8,10 +8,3 @@
 def xview(request):
     return HttpResponse()
 xview = xview_dec(xview)
-
-
-class ClassXView(object):
-    def __call__(self, request):
-        return HttpResponse()
-
-class_xview = xview_dec(ClassXView())

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to