Commit Graph

40 Commits

Author SHA1 Message Date
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
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
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
Alasdair Nicol c3aa2948c6 Fixed #21298 -- Fixed E301 pep8 warnings 2013-10-23 13:45:03 +01:00
Alasdair Nicol eb214452c3 Fixed #21270 -- Fixed E701 pep8 warnings 2013-10-17 12:12:40 +01:00
Aymeric Augustin cfcf4b3605 Stopped using django.utils.unittest in the test suite.
Refs #20680.
2013-07-01 14:29:33 +02:00
Marc Tamlyn 09f8652765 Use assertIsInstance in tests.
Gives much nicer errors when it fails.
2013-05-21 10:42:15 +01:00
Florian Apolloner 89f40e3624 Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00