It seems like the best approach, for my app at least, is to define a
decorator to handle the serializing and unserializing of objects
stored in session, e.g.
@sessionobjects
def mycontroller():
...
This seems to be working, but I'm wondering if it has any known
gotchas relative to the under-t
yes.
On May 6, 3:58 pm, MikeEllis wrote:
> Thanks, Massimo. Makes perfect sense now that you've explained it.
> The nature of my app is such that I really do need to keep the object
> in the session, so just to make sure I understand, I need to do
> something like
>
> session.problem = cPickle
Thanks, Massimo. Makes perfect sense now that you've explained it.
The nature of my app is such that I really do need to keep the object
in the session, so just to make sure I understand, I need to do
something like
session.problem = cPickle.dumps(problem)
before leaving any function that alte
in web2py you CANNOT store an object into a session unless you store
it already serialized. This is because the session is retrieved before
your code is executed and therefore before the module in question is
imported.
On May 6, 3:03 pm, MikeEllis wrote:
> Oops forgot to include "import os" in my
Oops forgot to include "import os" in my example code. It was imported
elsewhere in my app. With that correction, I have now reproduced the
problem in a new app containing nothing but the example code.
I've tried googling the PicklingError message and found some
references to problems under WSGI
More info:
I've confirmed that any class defined in the modules directory can
reproduce the problem. To verify, create a new module named
"dummyclass.py" containing
import uuid
class Problem(object):
""" Just to validate that session.problem pickling error
is not related to anything
6 matches
Mail list logo