summaryrefslogtreecommitdiff
path: root/django/utils/decorators.py
AgeCommit message (Collapse)Author
2026-01-31Refs #34118 -- Removed asgiref coroutine detection shims.Jacob Walls
As Python 3.12 is now the floor, we can drop the shims and use the `inspect` module.
2025-07-23Refs #36500 -- Rewrapped long docstrings and block comments via a script.django-bot
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
2024-08-30Fixed #35083 -- Updated method_decorator to handle async methods.Vaarun Sinha
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com> Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
2023-09-13Refs #31949 -- Made make_middleware_decorator to work with async functions.Ben Lomax
2023-02-01Refs #33476 -- Applied Black's 2023 stable style.David Smith
Black 23.1.0 is released which, as the first release of the year, introduces the 2023 stable style. This incorporates most of last year's preview style. https://github.com/psf/black/releases/tag/23.1.0
2022-05-25Renamed wrapped functions to wrapper.Aymeric Augustin
All these functions are wrapping another function. They're the wrapper, while the function they're wrapping is the wrapped.
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-10-20Fixed #33043 -- Made method_decorator() preserve wrapper assignments.Vinay Karanam
Regression in f434f5b84f7fcea9a76a551621ecce70786e2899.
2020-03-18Fixed #31224 -- Added support for asynchronous views and middleware.Andrew Godwin
This implements support for asynchronous views, asynchronous tests, asynchronous middleware, and an asynchronous test client.
2020-02-18Refs #26601 -- Deprecated passing None as get_response arg to middleware ↵Claude Paroz
classes. This is the new contract since middleware refactoring in Django 1.10. Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2019-10-21Fixed #30876 -- Moved classproperty() decorator to the django.utils.functional.André Ericson
2019-02-05Refs #27753 -- Removed django.utils.decorators.ContextDecorator alias.Tim Graham
2019-02-05Refs #27753 -- Removed django.utils.decorators.available_attrs().Tim Graham
2018-09-26Refs #29784 -- Switched to https:// links where available.Jon Dufresne
2018-06-27Refs #29253 -- Fixed method_decorator() crash if decorator sets a new attribute.Chris Jerdonek
Regression in fdc936c9130cf4fb5d59869674b9a31cc79a7999.
2018-04-16Fixed #29253 -- Made method_decorator(list) copy attributes.Chris Jerdonek
2017-02-11Refs #27656 -- Updated django.utils docstring verbs according to PEP 257.Anton Samarchyan
2017-01-25Refs #23919 -- Replaced super(ClassName, self) with super().chillaranand
2017-01-21Refs #23919 -- Removed django.utils.decorators.available_attrs() usage.Tim Graham
It's only needed to workaround a bug on Python 2.
2017-01-19Refs #23919 -- Removed usage of django.utils.decorators.ContextDecorator.Chillar Anand
2017-01-19Refs #23919 -- Stopped inheriting from object to define new style classes.Simon Charette
2017-01-18Refs #23919 -- Removed six.PY2/PY3 usageClaude Paroz
Thanks Tim Graham for the review.
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