Django

Code

Ticket #7517 (closed: fixed)

Opened 6 months ago

Last modified 6 months ago

Site.objects.get_current() returns deleted objects

Reported by: telenieko Assigned to: telenieko
Milestone: 1.0 Component: Contrib apps
Version: SVN Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

site_delete.diff (1.1 kB) - added by telenieko on 06/20/08 16:58:15.
Remove Site from CACHE on delete.

Change History

06/20/08 16:58:15 changed by telenieko

  • attachment site_delete.diff added.

Remove Site from CACHE on delete.

06/20/08 16:59:07 changed by telenieko

  • status changed from new to assigned.
  • needs_better_patch changed.
  • needs_tests changed.
  • owner changed from nobody to telenieko.
  • needs_docs changed.
  • stage changed from Unreviewed to Ready for checkin.

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

06/22/08 01:50:26 changed by russellm

  • status changed from assigned to closed.
  • resolution set to fixed.

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


Add/Change #7517 (Site.objects.get_current() returns deleted objects)




Change Properties
Action