[omaha] Django question

Steve Young wereapwhatwesow at gmail.com
Fri Jun 15 18:13:03 CEST 2012


>
> ... You might want to look at making deck a session variable.


So now I am trying to accomplish just that.  deck seems to be an
instancemethod because when I try to add it to the request.session it gives
a:

Can't pickle <type 'instancemethod'>: attribute lookup
__builtin__.instancemethod failed

I found some suggestions about adding __getstate__ and __setstate__ to the
class to make the instancemethod pickable, but  haven't been successful
with those either.  (not 100% sure I am implementing this correctly) The
only progress I made was using a shell to get a little different pickle
error:

PicklingError: Can't pickle <class 'sqlalchemy.orm.session.Session'>: it's
not the same object as sqlalchemy.orm.session.Session

I also tried Shawn's suggestion about encoding deck, with base64.encode and
base64.encodestring but got TypeErrors with both.

Since this is becoming so difficult, and I don't see much info online when
searching for these issues, it makes me think I am not taking the correct
approach.  Or maybe I should work some more on the pickling issue...  Any
ideas are welcome.  Thanks for everyone's help so far.

Steve


More information about the Omaha mailing list