Commits

Anonymous committed 15f6756

Fixed #15840 -- Wrapped inner function of the condition decorator with functools.wraps to follow best practices. Thanks, zsiciarz.

Comments (0)

Files changed (2)

django/views/decorators/http.py

     called.
     """
     def decorator(func):
+        @wraps(func, assigned=available_attrs(func))
         def inner(request, *args, **kwargs):
             # Get HTTP request headers
             if_modified_since = request.META.get("HTTP_IF_MODIFIED_SINCE")

tests/regressiontests/decorators/tests.py

 from django.utils.unittest import TestCase
 from django.views.decorators.cache import cache_page, never_cache, cache_control
 from django.views.decorators.clickjacking import xframe_options_deny, xframe_options_sameorigin, xframe_options_exempt
-from django.views.decorators.http import require_http_methods, require_GET, require_POST, require_safe
+from django.views.decorators.http import require_http_methods, require_GET, require_POST, require_safe, condition
 from django.views.decorators.vary import vary_on_headers, vary_on_cookie
 
 
     require_GET,
     require_POST,
     require_safe,
+    condition(lambda r: None, lambda r: None),
 
     # django.views.decorators.vary
     vary_on_headers('Accept-language'),