Commit Graph

56 Commits

Author SHA1 Message Date
Ben Lomax 74f7deec9e Refs #31949 -- Made make_middleware_decorator to work with async functions. 2023-09-13 11:41:01 +02:00
Ben Lomax 059cb0dbc9 Added more tests for decorators. 2023-09-13 10:16:01 +02:00
Ben Lomax b7a17b0ea0 Refs #31949 -- Made @vary_on_(cookie/headers) decorators work with async functions. 2023-07-10 11:43:36 +02:00
Ben Lomax 953f81e078 Refs #31949 -- Made @csrf_exempt decorator to work with async functions. 2023-07-10 07:55:02 +02:00
th3nn3ss 3152f9de47 Refs #31949 -- Made http decorators to work with async functions. 2023-06-26 09:29:04 +02:00
th3nn3ss cd4c4c1905 Added more tests for http decorators. 2023-06-26 09:29:04 +02:00
Mariusz Felisiak 865a6650d0 Moved http decorator tests into decorators/test_http.py. 2023-06-26 09:29:01 +02:00
Ben Lomax 23abec9192 Refs #31949 -- Made @no_append_slash decorator to work with async functions. 2023-05-23 10:04:41 +02:00
Ben Lomax 00f5d2d110 Refs #31949 -- Made @xframe_options_(deny/sameorigin/exempt) decorators to work with async functions. 2023-05-20 15:52:00 +02:00
Ben Lomax b43936f2ec Moved clickjacking decorator tests into decorators/test_clickjacking.py.
This also adds extra assertions.
2023-05-20 15:23:52 +02:00
Ben Lomax 4dfc6ff8a8 Refs #31949 -- Made @never_cache and @cache_control() decorators to work with async functions.
Thanks Carlton Gibson and Mariusz Felisiak for reviews.
2023-04-25 10:08:03 +02:00
Ben Lomax a14ddc8cfc Added more tests for @cache_control decorator. 2023-04-25 10:04:49 +02:00
Ben Lomax f2b97fbf06 Moved cache decorators tests into decorators/test_cache.py. 2023-04-04 09:53:31 +02:00
Aymeric Augustin 8cf4de206c Normalized decorator style for functools.wraps. 2022-05-25 10:58:48 +02:00
Aymeric Augustin 6485894157 Renamed wrapped functions to wrapper.
All these functions are wrapping another function. They're the wrapper,
while the function they're wrapping is the wrapped.
2022-05-25 10:53:52 +02:00
django-bot 9c19aff7c7 Refs #33476 -- Reformatted code with Black. 2022-02-07 20:37:05 +01:00
Mariusz Felisiak 40165eecc4
Fixed #33350 -- Reallowed using cache decorators with duck-typed HttpRequest.
Regression in 3fd82a6241.

Thanks Terence Honles for the report.
2021-12-16 20:13:17 +01:00
mgaligniana e61abab6e0 Refs #33338 -- Added never_cache() tests for Expires header. 2021-12-13 15:32:24 +01:00
Vinay Karanam 8806e8809e Fixed #33043 -- Made method_decorator() preserve wrapper assignments.
Regression in f434f5b84f.
2021-10-20 16:48:00 +02:00
Haki Benita 3fd82a6241 Refs #32468 -- Added error message on invalid usage of cache decorators. 2021-02-24 10:13:51 +01:00
Tom Carrick bcc2befd0e Fixed #31789 -- Added a new headers interface to HttpResponse. 2020-09-14 08:41:59 +02:00
Claude Paroz 4d973f5939 Refs #26601 -- Deprecated passing None as get_response arg to middleware 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>
2020-02-18 20:03:44 +01:00
nsasaki128 a289e79679 Fixed #30594 -- Added 'private' Cache-Control directive to never_cache() decorator. 2019-06-26 09:25:24 +02:00
Chris Jerdonek f434f5b84f Refs #29253 -- Fixed method_decorator() crash if decorator sets a new attribute.
Regression in fdc936c913.
2018-06-27 11:46:07 -04:00
Chris Jerdonek fdc936c913 Fixed #29253 -- Made method_decorator(list) copy attributes. 2018-04-16 13:38:37 -04:00
Chris Jerdonek 09f1f0387b Updated decorators test to use subTest(). 2018-04-16 12:48:01 -04:00
Tim Graham 29f607927f Fixed spelling of "nonexistent". 2017-02-03 08:01:45 -05:00
Tim Graham d170c63351 Refs #23919 -- Removed misc references to Python 2. 2017-01-21 20:02:00 -05:00
Simon Charette cecc079168 Refs #23919 -- Stopped inheriting from object to define new style classes. 2017-01-19 08:39:46 +01:00
Tim Graham 9d304b26cf Refs #20223 -- Removed deprecated django.utils.functional.allow_lazy(). 2017-01-17 20:52:02 -05:00
Ramin Farajpour Cami 967be82443 Fixed E305 flake8 warnings. 2016-11-14 12:30:46 -05:00
za 321e94fa41 Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings. 2016-11-10 21:30:21 -05:00
Jon Dufresne 4f336f6652 Fixed #26747 -- Used more specific assertions in the Django test suite. 2016-06-16 14:19:18 -04:00
Scott Vitale be729b6120 Fixed #10107 -- Allowed using mark_safe() as a decorator.
Thanks ArcTanSusan for the initial patch.
2016-06-07 12:24:03 -04:00
Iacopo Spalletti d693074d43 Fixed #20223 -- Added keep_lazy() as a replacement for allow_lazy().
Thanks to bmispelon and uruz for the initial patch.
2015-12-12 14:46:48 -05:00
Tim Graham 0b5d32faca Fixed #25611 -- Standardized descriptor signatures. 2015-10-26 11:31:16 -04:00
fabrizio ettore messina 186eb21dc1 Fixed #25269 -- Allowed method_decorator() to accept a list/tuple of decorators. 2015-09-18 19:04:29 -04:00
Rigel Di Scala 3bdaaf6777 Fixed #25146 -- Allowed method_decorator() to decorate classes. 2015-08-01 08:38:03 -04:00
Markus Bertheau 4a438e400b Fixed #13008 -- Added more Cache-Control headers to never_cache() decorator. 2015-04-28 12:07:02 -04:00
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Tim Graham 61ad1ea92b Removed django.utils.functional.memoize per deprecation timeline.
refs #21351.
2015-01-17 07:55:32 -05:00
Tim Graham 3131e9cef5 Fixed #23923 -- Promoted Django's deprecation warnings to errors in runtests.py 2014-11-29 10:27:04 -05:00
Marc Tamlyn 80cd64ee17 Fixed #21247 -- Made method_decorator play nicely with descriptors
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-02-09 11:23:09 +00:00
Tim Graham 4f8e8a6ec2 Removed unused imports + other flake8 fixes. 2014-02-09 06:13:10 -05:00
Marc Tamlyn 46a87214ca Merge pull request #1997 from dpwrussell/method_decorator_args_fix
Used available_attrs in method_decorator
2014-02-09 10:12:22 +00:00
dpwrussell 14940fdd96 Fixed #21513 -- Added method_decorator support for argumented decorator
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.
2014-01-10 10:45:26 +00:00
Aymeric Augustin 6e895f9e06 Removed superfluous models.py files.
Added comments in the three empty models.py files that are still needed.

Adjusted the test runner to add applications corresponding to test
labels to INSTALLED_APPS even when they don't have a models module.
2013-12-17 11:16:48 +01:00
Bouke Haarsma 9b7455e918 Fixed #21351 -- Replaced memoize with Python's lru_cache.
Replaced the custom, untested memoize with a similar decorator from Python's
3.2 stdlib. Although some minor performance degradation (see ticket), it is
expected that in the long run lru_cache will outperform memoize once it is
implemented in C.

Thanks to EvilDMP for the report and Baptiste Mispelon for the idea of
replacing memoize with lru_cache.
2013-11-11 08:53:09 +01:00
Jason Myers 3f115776e1 PEP8
Signed-off-by: Jason Myers <jason@jasonamyers.com>
2013-11-02 23:50:38 -05:00
Alex Gaynor 9d740eb8b1 Fix all violators of E231 2013-10-26 12:15:03 -07:00