1
0
mirror of https://github.com/django/django.git synced 2024-12-28 03:55:50 +00:00
Commit Graph

226 Commits

Author SHA1 Message Date
David Smith
80aae83439 [4.2.x] Refs #33476 -- Applied Black's 2023 stable style.
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

Backport of 097e3a70c1 from main
2023-02-01 11:37:29 +01:00
David Wobrock
99bd5fb4c2 Refs #34074 -- Used headers argument for RequestFactory and Client in docs and tests. 2023-01-04 09:11:36 +01:00
Leo
a1bcdc94da Fixed #34212 -- Made RedisCacheClient.incr() use write connection.
Co-authored-by: Sin-Woo Bang <sinwoobang@gmail.com>
2022-12-16 19:13:03 +01:00
Marti Raudsepp
32268456d6 Fixed #34209 -- Prevented FileBasedCache.has_key() crash caused by a race condition. 2022-12-13 19:29:15 +01:00
Christos Kopanos
608ab043f7 Fixed #33826 -- Fixed RedisCache.set_many()/delete_many() crash with an empty list. 2022-07-06 10:45:52 +02:00
Mariusz Felisiak
d27e6b233f
Fixed #33681 -- Made Redis client pass CACHES["OPTIONS"] to a connection pool.
Thanks Ben Picolo for the report.
2022-05-16 06:17:40 +02:00
Nick Pope
847f46e9bf
Removed redundant QuerySet.all() calls in docs and tests.
Most QuerySet methods are mapped onto the Manager and, in general,
it isn't necessary to call .all() on the manager.
2022-02-22 10:29:38 +01:00
Mariusz Felisiak
7119f40c98 Refs #33476 -- Refactored code to strictly match 88 characters line length. 2022-02-07 20:37:05 +01:00
django-bot
9c19aff7c7 Refs #33476 -- Reformatted code with Black. 2022-02-07 20:37:05 +01:00
Mariusz Felisiak
c5cd878382
Refs #33476 -- Refactored problematic code before reformatting by Black.
In these cases Black produces unexpected results, e.g.

def make_random_password(
    self,
    length=10,
    allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789',
):

or

cursor.execute("""
SELECT ...
""",
    [table name],
)
2022-02-03 11:20:46 +01:00
Jeremy Lainé
2f33217ea2 Fixed #33361 -- Fixed Redis cache backend crash on booleans. 2021-12-14 07:16:30 +01:00
Jeremy Lainé
c7902612ca Refs #33361 -- Added Added DummyCache.set() test for boolean values. 2021-12-14 06:47:37 +01:00
Arsa
17df72114e Fixed #33340 -- Fixed unquoted column names in queries used by DatabaseCache. 2021-12-09 11:16:04 +01:00
Iuri de Silvio
3ff7b15bb7 Fixed #33252 -- Made cache middlewares thread-safe. 2021-11-03 09:39:27 +01:00
Iuri de Silvio
0c05c183e4 Refs #33252 -- Used @override_settings in BaseCacheTests.test_cache_write_unpicklable_object() 2021-11-03 09:05:12 +01:00
Mariusz Felisiak
05f3a6186e Refs #32193 -- Removed MemcachedCache per deprecation timeline. 2021-09-20 21:23:01 +02:00
Daniyal
ec212c6616 Fixed #33012 -- Added Redis cache backend.
Thanks Carlton Gibson, Chris Jerdonek, David Smith, Keryn Knight,
Mariusz Felisiak, and Nick Pope for reviews and mentoring this
Google Summer of Code 2021 project.
2021-09-14 15:50:08 +02:00
Andrew-Chen-Wang
301a85a12f Fixed #32076 -- Added async methods to BaseCache.
This also makes DummyCache async-compatible.
2021-09-07 20:14:25 +02:00
Nick Pope
4b82578a60 Refs #33060 -- Ensured cache backends validate keys.
The validate_key() function should be called after make_key() to ensure
that the validation is performed on the key that will actually be
stored in the cache.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-09-07 11:59:40 +02:00
Mariusz Felisiak
ec2f6ea9c6 Refs #33060 -- Added memcached test for make_key() making keys invalid. 2021-09-07 11:57:14 +02:00
Nick Pope
b8824e8d17 Refs #31907 -- Fixed incorrect argument for delete_many() in cache tests. 2021-09-02 12:47:04 +02:00
Sondre Lillebø Gundersen
2c912c3488 Fixed #33061 -- Fixed handling nonexistent keys with negative deltas in incr()/decr() in memcached backends.
Thanks Chris Jerdonek for the review.
2021-08-31 07:34:53 +02:00
Sondre Lillebø Gundersen
96ab3a1379 Refs #33061 -- Added DummyCache.incr()/decr() tests for nonexistent keys with negative deltas. 2021-08-31 07:30:57 +02:00
Michael Lissner
5a8e8f80bb Fixed #32772 -- Made database cache count size once per set. 2021-05-26 11:21:11 +02:00
Mariusz Felisiak
958cdf65ae Fixed #32747 -- Prevented initialization of unused caches.
Thanks Alexander Ebral for the report.

Regression in 98e05ccde4.
2021-05-18 18:24:19 +02:00
ecogels
a0a5e0f4c8 Fixed #32705 -- Prevented database cache backend from checking .rowcount on closed cursor.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-05-05 12:41:59 +02:00
Nick Pope
bb64b99b78 Fixed #29867 -- Added support for storing None value in caches.
Many of the cache operations make use of the default argument to the
.get() operation to determine whether the key was found in the cache.
The default value of the default argument is None, so this results in
these operations assuming that None is not stored in the cache when it
actually is. Adding a sentinel object solves this issue.

Unfortunately the unmaintained python-memcached library does not support
a default argument to .get(), so the previous behavior is preserved for
the deprecated MemcachedCache backend.
2020-12-17 09:57:21 +01:00
Mariusz Felisiak
5ce31d6a71
Fixed #32193 -- Deprecated MemcachedCache. 2020-12-09 21:27:32 +01:00
Florian Apolloner
98e05ccde4 Fixed #32233 -- Cleaned-up duplicate connection functionality. 2020-12-08 08:55:44 +01:00
Mariusz Felisiak
0f00560d45 Refs #32233 -- Added tests for nonexistent cache backend. 2020-12-08 08:54:54 +01:00
Mariusz Felisiak
30f2d1af03 Refs #32233 -- Added tests for nonexistent cache and databases aliases. 2020-12-08 08:54:50 +01:00
Martin Thoma
302caa40e4 Made small readability improvements. 2020-10-28 20:20:20 +01:00
Mariusz Felisiak
0f18255848
Reverted "Reduced time.sleep() in cache touch() tests."
This reverts commit 177a49e79c
which caused more frequent failures of test_touch().
2020-10-19 19:54:23 +02:00
Nick Pope
177a49e79c Reduced time.sleep() in cache touch() tests.
There are 8 cache backends to test and each test of touch() takes
~7s → ~56s. This seems excessive and it feels like we should be able
to reduce this significantly. time.sleep() accepts floating point
values and is guaranteed to sleep for at least the number of seconds
specified as of Python 3.5.

We do run the risk that there may be spurious test failures from this,
but that already seemed to be the case anyway.
2020-10-16 13:13:15 +02:00
Nick Pope
b4d46df5ca Fixed #29887 -- Added a cache backend for pymemcache. 2020-09-16 09:40:30 +02:00
Nick Pope
cda0a3d777 Refs #29887, Refs #24212 -- Added more client servers tests for PyLibMCCache. 2020-09-16 07:38:32 +02:00
Tom Carrick
bcc2befd0e Fixed #31789 -- Added a new headers interface to HttpResponse. 2020-09-14 08:41:59 +02:00
Nick Pope
a629139425 Refs #29887, Refs #24212 -- Added servers configuration hook for memcached backends.
The servers property can be overridden to allow memcached backends to
alter the server configuration prior to it being passed to instantiate
the client. This allows avoidance of documentation for per-backend
differences, e.g. stripping the 'unix:' prefix for pylibmc.
2020-09-02 08:51:17 +02:00
Nick Pope
cc1f2c6a19 Refs #29887 -- Simplified memcached client instantiation. 2020-09-01 10:51:00 +02:00
Mariusz Felisiak
1853724aca Fixed CVE-2020-24584 -- Fixed permission escalation in intermediate-level directories of the file system cache on Python 3.7+. 2020-09-01 09:17:23 +02:00
Kevin Michel
abbdd3a622 Added tests for cache middlewares constructors. 2020-08-28 10:00:39 +02:00
Nick Pope
b5acb9db75 Fixed #31907 -- Fixed missing validate_key() calls in cache backends. 2020-08-24 09:41:21 +02:00
Nick Pope
9e04b242ee Refs #31907 -- Added cache key validation tests for cache operations. 2020-08-24 09:33:55 +02:00
Claude Paroz
258c88a913 Refs #5691 -- Made cache keys independent of USE_L10N.
This mostly reverts af1893c4ff.
2020-06-22 10:55:12 +02:00
Guillermo Bonvehí
f386454d13 Fixed #31728 -- Fixed cache culling when no key is found for deletion.
DatabaseCache._cull implementation could fail if no key was found to
perform a deletion in the table. This prevented the new cache key/value
from being correctly added.
2020-06-22 06:29:35 +02:00
Mariusz Felisiak
926148ef01
Fixed #31654 -- Fixed cache key validation messages. 2020-06-05 07:21:52 +02:00
David Smith
dbdc192ca3 Preferred usage of among/while to amongst/whilst. 2020-06-03 21:02:48 +02:00
Mariusz Felisiak
229c9c6653 Refs CVE-2020-13254 -- Fixed cache.tests when KEY_PREFIX is defined.
Follow up to 2c82414914.
2020-06-03 13:00:37 +02:00
Dan Palmer
2c82414914 Fixed CVE-2020-13254 -- Enforced cache key validation in memcached backends. 2020-06-03 09:24:26 +02:00
Jon Dufresne
c1c361677d Made BaseCacheTests skip culling tests if culling is not supported. 2020-03-19 15:34:16 +01:00