Aha.  I fear I'll be accused of mumbling to myself, but I think I
understand now that what you meant by your x.Y = Y example.

We also have a theory that it's adding model objects to sessions that
causes our problem because model objects are created dynamically by
their meta classes.  Am I close?  Could it still be not deleting the
*.pyc files?

Mae

On Apr 5, 12:17 pm, "Mae" <[EMAIL PROTECTED]> wrote:
> Er, that would be "a sporadic "TypeError: can't pickle function
> objects" problem" :).  Forgot to paste.
>
> On Apr 5, 12:08 pm, "Mae" <[EMAIL PROTECTED]> wrote:
>
> > Wow, what luck!  I've been having a sporadic "" problem, and I've just
> > resigned myself to spending today to try to debug it.  Searched the
> > group for exact error, found nothing, refreshed, and saw this post in
> > top slot!  Kismet.
>
> > Jeremy, I'm not sure I understood your last post well enough.  Could
> > you explain?  I have code that goes like this:
>
> > file: cart_models.py
> > class Cart(object):
> > ...
>
> > file: views.py
> > from myproject.cart_models import Cart
> > cart = Cart()
> > request.session['cart'] = cart
> > ...
>
> > I also have several other examples where I instantiate a model object
> > or another object and then add it to something that later gets added
> > to the session.
>
> > Is what I'm doing "monkey patching"?  What does "monkey patching"
> > mean?  How am I making it difficult for the pickling functions to
> > figure out my "type name"?  What should I do to fix it?
>
> > Is it possible that running svn update on my directories and
> > restarting Apache without deleting all of the old compiled *.pyc files
> > first is the "monkey patching" that screws up my server?
>
> > Thanks so much,
> > Mae
>
> > On Apr 5, 11:50 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
>
> > > On 4/5/07, paceman <[EMAIL PROTECTED]> wrote:
> > > ...
>
> > > > I wonder if apache prefork reloads modules (maybe psycopg2) that I am
> > > > not aware of and that causes the pickling of the object not to work?
>
> > > This would also occur if you were monkey patching classes, I think.
>
> > > Do you have anything that does something like this:
>
> > > import x
>
> > > class Y(object):
> > >   pass
>
> > > x.Y = Y
>
> > > ?
>
> > > The basic issue is that pickling works by serializing a type*name*
> > > plus some state for that object.  If the type changes from the time
> > > the object is created until the time the serialization is attempted,
> > > pickle gives up.


--~--~---------~--~----~------------~-------~--~----~
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