-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Ticket 35276 FileBasedCache check method #18008
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! Thank you for your contribution 💪
As it's your first contribution be sure to check out the patch review checklist.
If you're fixing a ticket from Trac make sure to set the "Has patch" flag and include a link to this PR in the ticket!
If you have any design or process questions then you can ask in the Django forum.
Welcome aboard ⛵️!
3545cd3
to
78a6fec
Compare
43019af
to
9870a6d
Compare
build/ | ||
tests/report/ | ||
tests/screenshots/ | ||
./idea |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be added see comment at top.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, removed
if location is not None and not pathlib.Path(location).is_absolute(): | ||
return [ | ||
Warning( | ||
f"Your '{alias_name}' cache LOCATION path is relative. Use an " | ||
f"absolute path instead.", | ||
id="caches.W003", | ||
) | ||
return errors | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this work for multiple file based caches?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will not work, made changes. Thank you for your comment!
|
||
|
||
@register(Tags.caches) | ||
def check_file_based_cache_is_absolute(app_configs, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't the point of ticket to drop these here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed instance check of cache for FileBaseCache and lightened part with cache iteration. Also I thought to remove this two function (in cache.py) and directly address to main class of FileBaseCache, but I stayed with the opinion to leave them. Could you suggest which way is better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pro100-Almaz Thanks 👍 I left initial comments. Also, tests updates and docs changes (we should mention it here) are missing.
django/core/cache/backends/base.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The base implementation should return an empty list instead of raising exceptions.
django/core/checks/caches.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main idea is to run check()
on all caches, not to leave the same functions that will run class methods. Check what we did in a similar patches, e.g. 0fb104d.
Please don't leave the PR description as "Provide a concise overview of the issue or rationale behind the proposed changes." - if you don't know what to write you can always say "see ticket". |
Use the PR and commit title: “Fixed #35276 -- Moved cache checks to backend classes.” Squash all your commits into one, at least when you’re done working. You can follow my guide: https://adamj.eu/tech/2022/03/25/how-to-squash-and-rebase-a-git-branch/ . |
63dfe38
to
9870a6d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be an instance method, you should see when you get the loop in place.
Superseded by #19426. |
Trac ticket number
ticket-35276
Branch description
check ticket
Checklist
main
branch.