Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #15840 -- Wrapped inner function of the condition decorator wit…

…h functools.wraps to follow best practices. Thanks, zsiciarz.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17470 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 4b71c9998e4983e193bb3b648a8a445edd54c52f 1 parent 49288f8
Jannis Leidel authored February 09, 2012
1  django/views/decorators/http.py
@@ -74,6 +74,7 @@ def condition(etag_func=None, last_modified_func=None):
74 74
     called.
75 75
     """
76 76
     def decorator(func):
  77
+        @wraps(func, assigned=available_attrs(func))
77 78
         def inner(request, *args, **kwargs):
78 79
             # Get HTTP request headers
79 80
             if_modified_since = request.META.get("HTTP_IF_MODIFIED_SINCE")
3  tests/regressiontests/decorators/tests.py
@@ -11,7 +11,7 @@
11 11
 from django.utils.unittest import TestCase
12 12
 from django.views.decorators.cache import cache_page, never_cache, cache_control
13 13
 from django.views.decorators.clickjacking import xframe_options_deny, xframe_options_sameorigin, xframe_options_exempt
14  
-from django.views.decorators.http import require_http_methods, require_GET, require_POST, require_safe
  14
+from django.views.decorators.http import require_http_methods, require_GET, require_POST, require_safe, condition
15 15
 from django.views.decorators.vary import vary_on_headers, vary_on_cookie
16 16
 
17 17
 
@@ -38,6 +38,7 @@ def _inner(*args, **kwargs):
38 38
     require_GET,
39 39
     require_POST,
40 40
     require_safe,
  41
+    condition(lambda r: None, lambda r: None),
41 42
 
42 43
     # django.views.decorators.vary
43 44
     vary_on_headers('Accept-language'),

0 notes on commit 4b71c99

Please sign in to comment.
Something went wrong with that request. Please try again.