Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#7517 closed (fixed)

Site.objects.get_current() returns deleted objects

Reported by: Marc Fargas Owned by: Marc Fargas
Component: Contrib apps Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


#7514 lead to find this bug.

>>> from django.contrib.sites.models import Site
>>> s = Site.objects.get_current()
>>> s

>>> s.delete()
>>> Site.objects.get_current()

Obviously, the last one should be a DoesNotExist. Patch incoming.

Attachments (1)

site_delete.diff (1.1 KB) - added by Marc Fargas 8 years ago.
Remove Site from CACHE on delete.

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by Marc Fargas

Attachment: site_delete.diff added

Remove Site from CACHE on delete.

comment:1 Changed 8 years ago by Marc Fargas

Needs documentation: unset
Needs tests: unset
Owner: changed from nobody to Marc Fargas
Patch needs improvement: unset
Status: newassigned
Triage Stage: UnreviewedReady for checkin

Attached patch overrides Site.delete() to delete the Site from the SITE_CACHE.
Includes a test.

comment:2 Changed 8 years ago by Russell Keith-Magee

Resolution: fixed
Status: assignedclosed

(In [7724]) Fixed #7517 -- Added code to remove Sites from the site cache when they are deleted. Thanks to Marc Fargas for the patch.

comment:3 Changed 5 years ago by Jacob

milestone: 1.0

Milestone 1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top