Opened 16 years ago
Closed 16 years ago
#9228 closed (fixed)
Keep SITE_CACHE cache in line with changes to Site instances
Reported by: | Boo | Owned by: | nobody |
---|---|---|---|
Component: | Contrib apps | Version: | dev |
Severity: | Keywords: | ||
Cc: | boobsd@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
This patch updates SITE_CACHE after saving Site model.
You do not have to restart Django-project after changing Site model.
Attachments (3)
Change History (10)
by , 16 years ago
Attachment: | sites.diff added |
---|
follow-up: 2 comment:1 by , 16 years ago
Needs tests: | set |
---|---|
Patch needs improvement: | set |
Summary: | Simple patch for contrib.sites → Keep SITE_CACHE cache in line with changes to Site instances |
Triage Stage: | Unreviewed → Accepted |
Changed the title to describe the problem being addressed.
This is a good idea, but the implementation needs some work before it can go in:
- It needs a test. There is a
tests.py
indjango/contrib/sites/
. - The
save()
method takes a couple of required parameters, not justself
(see the Model documentation). - To avoid duplicating work, in case we change how things are loaded into that cache, it will be better to just remove the relevant key from the
SITE_CACHE
dictionary. Then the next call toget_current()
will reload it correctly (whatever "correctly" means now or in the future).
comment:2 by , 16 years ago
Replying to mtredinnick:
This is a good idea, but the implementation needs some work before it can go in:
- It needs a test. There is a
tests.py
indjango/contrib/sites/
.- The
save()
method takes a couple of required parameters, not justself
(see the Model documentation).- To avoid duplicating work, in case we change how things are loaded into that cache, it will be better to just remove the relevant key from the
SITE_CACHE
dictionary. Then the next call toget_current()
will reload it correctly (whatever "correctly" means now or in the future).
Ok, done.
comment:3 by , 16 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
follow-up: 5 comment:4 by , 16 years ago
Needs tests: | unset |
---|---|
Triage Stage: | Ready for checkin → Accepted |
I applied the test part of the patch and left out the other part, ran the tests and they passed. A test for a fix should fail before the fix is applied and pass afterwards and this test isn't doing that.
Also, you patch mixes tabs and spaces. It should be spaces only for indentation, please.
by , 16 years ago
Attachment: | sites_v3.diff added |
---|
comment:5 by , 16 years ago
Replying to mtredinnick:
I applied the test part of the patch and left out the other part, ran the tests and they passed. A test for a fix should fail before the fix is applied and pass afterwards and this test isn't doing that.
Also, you patch mixes tabs and spaces. It should be spaces only for indentation, please.
I ran into the same thing. As far as I can see, it has something to do with the difference between running in the shell and Apache2.
comment:7 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Patch