alfonsodg / demo-web2py

Apache License 2.0
0 stars 0 forks source link

problems with sessions on GAE #20

Closed alfonsodg closed 10 years ago

alfonsodg commented 10 years ago

From robi...@gmail.com on July 10, 2008 02:18:10

This was the the traceback: Traceback (most recent call last): File "/base/data/home/apps/ruly/1.6/gluon/main.py", line 194, in wsgibase session._try_store_in_db(request,response) File "/base/data/home/apps/ruly/1.6/gluon/globals.py", line 165, in _try_store_in_db session_data=cPickle.dumps(dict(self)), File "/base/python_dist/lib/python2.5/pickle.py", line 1359, in dumps Pickler(file, protocol).dump(obj) File "/base/python_dist/lib/python2.5/pickle.py", line 218, in dump self.save(obj) File "/base/python_dist/lib/python2.5/pickle.py", line 280, in save f(self, obj) # Call unbound method with explicit self File "/base/python_dist/lib/python2.5/pickle.py", line 643, in save_dict self._batch_setitems(obj.iteritems()) File "/base/python_dist/lib/python2.5/pickle.py", line 657, in _batch_setitems save(v) File "/base/python_dist/lib/python2.5/pickle.py", line 325, in save self.save_reduce(obj=obj, *rv) File "/base/python_dist/lib/python2.5/pickle.py", line 394, in save_reduce save(func) File "/base/python_dist/lib/python2.5/pickle.py", line 280, in save f(self, obj) # Call unbound method with explicit self File "/base/python_dist/lib/python2.5/pickle.py", line 747, in save_global (obj, module, name)) PicklingError: Can't pickle <function _reconstructor at 0x9d7374991e63bf68>: it's not the same object as copy_reg._reconstructor

The get the app running on GAE, I commented out the session from forms and flash.

Also when I first tried to comment out: session.connect(request,response,db=db)

The GAE app raised an error trying to write to disk.

This is running from trunk.

Original issue: http://code.google.com/p/web2py/issues/detail?id=20

alfonsodg commented 10 years ago

From robi...@gmail.com on July 10, 2008 07:26:00

Looks like the problem with the session was caused by this:

session.flash=T("OK, %s accepted." % item)

It works if I change to this:

session.flash="OK, %s accepted." % item

Looks like the translation could not be pickled.

Would it make sense to wrap _try_store_on_disk in a try/catch for someone that is not using the sessions on GAE?

Robin

alfonsodg commented 10 years ago

From massimod...@gmail.com on July 10, 2008 08:15:07

cPickle cannot picke lazyT objects. Simply replace

session.flash=T("OK, %s accepted." % item)

with

session.flash=str(T("OK, %(item)s accepted.",dict(item=item)))

in your code

Status: WontFix