Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #33060 -- Added BaseCache.make_and_validate_key() hook. #14802

Merged
merged 3 commits into from Sep 7, 2021

Conversation

ngnpope
Copy link
Member

@ngnpope ngnpope commented Aug 26, 2021

ticket-33060

Following on from #14437 (comment).

Copy link
Contributor

@cjerdonek cjerdonek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple comments.

django/core/cache/backends/db.py Show resolved Hide resolved
django/core/cache/backends/dummy.py Outdated Show resolved Hide resolved
@ngnpope ngnpope force-pushed the ticket-33060 branch 2 times, most recently from 42a14ad to 97e570a Compare August 26, 2021 23:20
tests/cache/tests.py Outdated Show resolved Hide resolved
tests/cache/tests.py Outdated Show resolved Hide resolved
@felixxm
Copy link
Member

felixxm commented Sep 2, 2021

@ngnpope I found one more case and merged the first commit in b8824e8.

@felixxm
Copy link
Member

felixxm commented Sep 3, 2021

Merged the 3rd commit in 68b8eda.

@felixxm
Copy link
Member

felixxm commented Sep 3, 2021

@ngnpope Thanks 👍

I rebased and pushed edits to tests.

@felixxm felixxm requested a review from a team September 3, 2021 09:44
@felixxm felixxm changed the title Fixed #33060 -- Added .make_and_validate_key() to base cache backend. Fixed #33060 -- Added BaseCache.make_and_validate_key() hook. Sep 3, 2021
tests/cache/tests.py Outdated Show resolved Hide resolved
Copy link
Member

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, this looks neat. Thanks all!

Commit message niggle — Not sure about ...which will be stored here:

Refs #33060 -- Ensured cache backends validate keys which will be stored.

django/core/cache/backends/base.py Outdated Show resolved Hide resolved
felixxm and others added 3 commits September 7, 2021 11:57
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>
This helper function reduces the amount of duplicated code and makes it
easier to ensure that we always validate the keys.
@felixxm
Copy link
Member

felixxm commented Sep 7, 2021

@carltongibson Thanks for the review 👍 Suggestions applied.

@felixxm felixxm merged commit 42dfa97 into django:main Sep 7, 2021
@ngnpope ngnpope deleted the ticket-33060 branch September 7, 2021 10:39
@ngnpope
Copy link
Member Author

ngnpope commented Sep 7, 2021

Thanks for polishing this off @felixxm 🦸🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants