summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2012-02-09 18:57:06 +0000
committerJannis Leidel <jannis@leidel.info>2012-02-09 18:57:06 +0000
commit4b71c9998e4983e193bb3b648a8a445edd54c52f (patch)
tree34baf401dfe6db3f2bcae6655a6ad81257c3c4d8
parent49288f838809d797fa7b8b2e6a2cb2f65d6cf8bd (diff)
Fixed #15840 -- Wrapped inner function of the condition decorator with functools.wraps to follow best practices. Thanks, zsiciarz.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17470 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/views/decorators/http.py1
-rw-r--r--tests/regressiontests/decorators/tests.py3
2 files changed, 3 insertions, 1 deletions
diff --git a/django/views/decorators/http.py b/django/views/decorators/http.py
index 495a7b10d5..387b869000 100644
--- a/django/views/decorators/http.py
+++ b/django/views/decorators/http.py
@@ -74,6 +74,7 @@ def condition(etag_func=None, last_modified_func=None):
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")
diff --git a/tests/regressiontests/decorators/tests.py b/tests/regressiontests/decorators/tests.py
index 51f75d7b56..749df43e0c 100644
--- a/tests/regressiontests/decorators/tests.py
+++ b/tests/regressiontests/decorators/tests.py
@@ -11,7 +11,7 @@ from django.utils.functional import allow_lazy, lazy, memoize
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
@@ -38,6 +38,7 @@ full_decorator = compose(
require_GET,
require_POST,
require_safe,
+ condition(lambda r: None, lambda r: None),
# django.views.decorators.vary
vary_on_headers('Accept-language'),