On Wed, 2008-09-10 at 07:33 -0700, TheShark wrote:
[...]

> assert Widget.objects.all().count()==1
> assert Sprocket.objects.all().count()==1
> 
> #print w.sprocket
> s.w=None
> s.save()
> w.delete()
> 
> assert Widget.objects.all().count()==0
> assert Sprocket.objects.all().count()==1
> 
> The assert's pass as long as the print statement is commented out. If
> I include the print, then my Sprocket s gets deleted along with w
> despite the fact that I removed the reference between the two. This is
> problematic because it makes it really hard to override the cascading
> delete() feature. I tried having a pre_delete() method on my Model
> which would reset the references, but the mere act of accessing the
> reverse reference (w.sprocket in the example above) seems to cause the
> reference to get cached somehow. There are other ways to view similar
> behavior, but the test case above is about the most succinct. Is there
> any reason to think this is the correct behavior, or should I open a
> bug?

If the two behaviours are different it's a bug. The cached reference is
confusing things here. Fortunately, this isn't a particularly common
usage pattern for delete(), but we should fix it.

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to