On Friday, 30 March 2012 12:04:05 UTC+11, Limedrop wrote: > > If instances are pickable then you should be okay. Have you tried saving > them to the session and seeing what happens? Note that sometimes you can > pickle things okay but the unpickle throws the error. > > > Have you tried saving them to the session and seeing what happens?
I have - weird stuff happens. The class I have been testing is supposed to accumulate elements like a set. The first one I add (in the controller for the view for debugging) gets stored in the instance fine, and it seems to persist when I save the instance to session. However, when I add other elements (in a separate function called by the javascript) to that instance they get added while in the function, but don't seem to persist in the object saved in the session. It is like the instance is a local variable initialised from what is first stored by the controller. I can modify the original instance like it is a local variable, but changes don't stay there to the next call. > Failing that have a look at the recipe near the bottom of this thread... > > http://bytes.com/topic/python/answers/552476-why-cant-you-pickle-instancemethods > > BTW, that's no good for web2py classes, which don't pickle because they > are db connections thanks for the link I will try to decipher it.

