Skip to content

Conversation

Pro100-Almaz
Copy link

@Pro100-Almaz Pro100-Almaz commented Mar 24, 2024

Trac ticket number

ticket-35276

Branch description

check ticket

Checklist

  • This PR targets the main branch.
  • The commit message is written in past tense, mentions the ticket number, and ends with a period.
  • I have checked the "Has patch" ticket flag in the Trac system.
  • I have added or updated relevant tests.
  • I have added or updated relevant docs, including release notes if applicable.
  • For UI changes, I have attached screenshots in both light and dark modes.

Copy link

@github-actions github-actions bot left a 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 ⛵️!

@Pro100-Almaz Pro100-Almaz changed the title Ticket 35276 Ticket 35276 FileBasedCache check method Mar 24, 2024
build/
tests/report/
tests/screenshots/
./idea
Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

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

Sure, removed

Comment on lines +63 to +70
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
]
Copy link
Contributor

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?

Copy link
Author

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):
Copy link
Contributor

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?

Copy link
Author

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?

Copy link
Member

@felixxm felixxm left a 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.

Copy link
Member

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.

Copy link
Member

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.

@adamchainz
Copy link
Member

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".

@adamchainz
Copy link
Member

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/ .

Copy link
Member

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.

@felixxm
Copy link
Member

felixxm commented Apr 27, 2025

Superseded by #19426.

@felixxm felixxm closed this Apr 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants