Author: jezdez
Date: 2012-02-09 10:57:06 -0800 (Thu, 09 Feb 2012)
New Revision: 17470
Modified:
django/trunk/django/views/decorators/http.py
django/trunk/tests/regressiontests/decorators/tests.py
Log:
Fixed #15840 -- Wrapped inner function of the condition decorator with
functools.wraps to follow best practices. Thanks, zsiciarz.
Modified: django/trunk/django/views/decorators/http.py
===================================================================
--- django/trunk/django/views/decorators/http.py 2012-02-09 18:56:58 UTC
(rev 17469)
+++ django/trunk/django/views/decorators/http.py 2012-02-09 18:57:06 UTC
(rev 17470)
@@ -74,6 +74,7 @@
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")
Modified: django/trunk/tests/regressiontests/decorators/tests.py
===================================================================
--- django/trunk/tests/regressiontests/decorators/tests.py 2012-02-09
18:56:58 UTC (rev 17469)
+++ django/trunk/tests/regressiontests/decorators/tests.py 2012-02-09
18:57:06 UTC (rev 17470)
@@ -11,7 +11,7 @@
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 @@
require_GET,
require_POST,
require_safe,
+ condition(lambda r: None, lambda r: None),
# django.views.decorators.vary
vary_on_headers('Accept-language'),
--
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.