Monday, December 26, 2011

Re: Is Django deleting my python objects?

I found out that using another field, as "slug" instead of "id", so
that
"dictionary[instance.id] = some_value" becomes
"dictionary[instance.slug] = some_value",
the behaviour is different: the dictionary isn't affected when the
object is deleted.
Is not instance.id a simple integer then?
Seems it has a special meaning, and objects are collected after that.


On Dec 26, 6:32 pm, devbird <antig...@gmail.com> wrote:
> It's very awkward: there's no strict relation between the dictionary
> keys and the deleted objects, but the keys are deleted together with
> the objects.
> I found where it happens: it's between the pre_delete and the
> post_delete send in the django.models.deletion.Collector delete()
> method, still I can't figure out why.
>
> On Dec 26, 6:17 pm, devbird <antig...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I'm running tests.
> > And I don't have any post_delete or pre_delete signal handler defined.
>
> > On Dec 26, 6:02 pm, Javier Guerra Giraldez <jav...@guerrag.com> wrote:
>
> > > On Mon, Dec 26, 2011 at 11:09 AM, devbird <antig...@gmail.com> wrote:
> > > > dictionary
> > > > is the attribute of a singleton object. It lives as long as the server
> > > > instance is up.
>
> > > > How could it be possible?
>
> > > are you running a single instance of your django process? the
> > > development server does; but any non-toy deployment fires up several
> > > workers.
>
> > > --
> > > Javier

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment