Opened 17 years ago

Closed 17 years ago

Last modified 13 years ago

#7517 closed (fixed)

Site.objects.get_current() returns deleted objects

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

Description

#7514 lead to find this bug.

>>> from django.contrib.sites.models import Site
>>> s = Site.objects.get_current()
>>> s
<Site: example.com>

>>> s.delete()
>>> Site.objects.get_current()
<Site: example.com>

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

Attachments (1)

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

Download all attachments as: .zip

Change History (4)

by Marc Fargas, 17 years ago

Attachment: site_delete.diff added

Remove Site from CACHE on delete.

comment:1 by Marc Fargas, 17 years ago

Owner: changed from nobody to Marc Fargas
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 by Russell Keith-Magee, 17 years ago

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 by Jacob, 13 years ago

milestone: 1.0

Milestone 1.0 deleted

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