summaryrefslogtreecommitdiff
path: root/django/utils/decorators.py
AgeCommit message (Collapse)Author
2016-01-25Fixed #26125 -- Fixed E731 flake warnings.userimack
2015-10-26Fixed #25611 -- Standardized descriptor signatures.Tim Graham
2015-09-18Fixed #25269 -- Allowed method_decorator() to accept a list/tuple of decorators.fabrizio ettore messina
2015-08-01Fixed #25146 -- Allowed method_decorator() to decorate classes.Rigel Di Scala
2015-06-12Fixed #24965 -- Made LiveServerTestCase.live_server_url accessible from classMoritz Sichert
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2014-11-24Fixed typo in django/utils/decorators.py comment.Tom V
2014-08-28Factorize some code using ContextDecorator.Thomas Chaumeny
2014-08-15Fixed #23287 -- Updated error message for classonlymethod decorator.Tim Graham
2014-02-09Fixed #21247 -- Made method_decorator play nicely with descriptorsMarc Tamlyn
When a method decorator was used in conjunction with a decorator implemented as a descriptor, method_decorator did not correctly respect the method binding. Thanks for Graham Dumpleton for the report and initial patch.
2014-01-10Fixed #21513 -- Added method_decorator support for argumented decoratordpwrussell
Copied attributes into the decorated method and special case __name__ copy as this will not be present on a Class object. Added regression test to decorator suite.
2013-10-23Fixed #21298 -- Fixed E301 pep8 warningsAlasdair Nicol
2013-03-12Restricted a workaround for a bug in Python to the affected versions.Aymeric Augustin
2012-04-29Fixed #18013 -- Use the new 'as' syntax for exceptions.Claude Paroz
Thanks Clueless for the initial patch. Note that unittest has been purposely left out (external package only used by Python 2.6).
2011-05-24Fixed #16004 - csrf_protect does not send cookie if view returns ↵Luke Plant
TemplateResponse The root bug was in decorator_from_middleware, and the fix also corrects bugs with gzip_page and other decorators. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16276 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-05-01Replaced old-style with new-style decorator syntax.Jannis Leidel
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16138 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-28Removed a bunch more Python 2.4 workarounds now that we don't support that ↵Adrian Holovaty
version. Refs #15702 -- thanks to jonash for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15927 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-20Fixed #14512 -- Added documentation on how to apply decorators to ↵Russell Keith-Magee
class-based generic views. Thanks to Łukasz Rekucki for his work on the issue. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14642 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-21Fixed a bug with method_decorator not preserving the attributes of the ↵Luke Plant
wrapped method, which is important for decorators like csrf_exempt git-svn-id: http://code.djangoproject.com/svn/django/trunk@14311 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-05-13Corrected 'name' of functions wrapped with method_decoratorLuke Plant
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13249 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-05-04Fixed #12164 -- Removed the Python 2.3 compatibility imports and ↵Russell Keith-Magee
workarounds. Thanks to timo and claudep for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13094 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-12Fixed #13093 -- Updated some decorators and the decorator_from_middleware ↵Russell Keith-Magee
function to allow callable classes to be decorated. Thanks to Brian Neal for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12762 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-09Fixed #12804 - regression with decorating admin views.Luke Plant
This is a BACKWARDS INCOMPATIBLE change, because it removes the flawed 'auto_adapt_to_methods' decorator, and replaces it with 'method_decorator' which must be applied manually when necessary, as described in the 1.2 release notes. For users of 1.1 and 1.0, this affects the decorators: * login_required * permission_required * user_passes_test For those following trunk, this also affects: * csrf_protect * anything created with decorator_from_middleware If a decorator does not depend on the signature of the function it is supposed to decorate (for example if it only does post-processing of the result), it will not be affected. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12399 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-10-15Licence block for code added in r11586Luke Plant
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11627 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-10-01Removed some unused code and improved docstring on auto_adapt_to_methodsLuke Plant
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11600 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-09-22Fixed typo in docstring for decorator_from_middleware_with_args.Luke Plant
Thanks for the report, kmike git-svn-id: http://code.djangoproject.com/svn/django/trunk@11590 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-09-21Fixed #6371 - several decorators don't work with bound methods.Luke Plant
This involved changing the way the internal function decorator_from_middleware works slightly, breaking some code that relied on the old behaviour. As a result, it is much simpler, but cache_page has been made slightly more complex to cope with the change. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11586 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-17Fixed #6679 -- In `decorator_from_middleware`, don't unpack arguments when ↵Gary Wilson Jr
calling a middleware's `process_view` method, thanks Gulopine. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7269 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-25Fixed #5701 -- Fixed decorators to take the name, attributes, and docstring ↵Gary Wilson Jr
of the function they decorate by adding a modified version of the `functools.wraps` function from Python 2.5. `wraps` has been altered to work with Django's `curry` function and with Python 2.3, which doesn't allow assignment of a function's `__name__` attribute. This fixes severaly annoyances, such as the online documentation for template filters served by the admin app. This change is backwards incompatible if, for some reason, you were relying on the name of a Django decorator instead of the function it decorates. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7153 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-07Corrected misleading comment from [5619]. Not sure what I was smoking at theMalcolm Tredinnick
time. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5631 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-05Fixed #1015 -- Fixed decorator_from_middleware to return a real decorator evenMalcolm Tredinnick
when arguments are given. This looks a bit ugly, but it's fully backwards compatible and all the extra work is done at import time, so it shouldn't have any real performance impact. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5619 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-11-27Fixed #878 -- URLconf regex captures no longer have to be named groups. Old ↵Adrian Holovaty
URLconfs (with named groups) still work. This is backwards-incompatible if you've defined custom middleware with a process_view function. See http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges git-svn-id: http://code.djangoproject.com/svn/django/trunk@1470 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-11-04Fixed bug in django.utils.decorators.decorator_from_middleware -- it wasn't ↵Adrian Holovaty
raising exceptions. Refs #641 git-svn-id: http://code.djangoproject.com/svn/django/trunk@1076 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-10-15Fixed #616 -- Added a process_exception() hook to middleware framework. ↵Adrian Holovaty
Thanks, Hugo git-svn-id: http://code.djangoproject.com/svn/django/trunk@880 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-10-10Fixed #600 -- decorator_from_middleware now handles process_view. Thanks, HugoAdrian Holovaty
git-svn-id: http://code.djangoproject.com/svn/django/trunk@820 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-10-08Added django.utils.decorators, from Hugo's #580 patch. Refs #580.Adrian Holovaty
git-svn-id: http://code.djangoproject.com/svn/django/trunk@807 bcc190cf-cafb-0310-a4f2-bffc1f526a37