I'm sorry if this appears twice anywhere, I made this post last night
but I think groups lied about it being posted, as I can find no trace
of it.

After thinking some things through I think I understand the problem
behind my previous question and am now trying a new route. As I
generate forms, I would like to store them in the users session, or
any temporary storage really, so that if the user visits the page
again, any un-submitted forms will appear. The problem is I get a
strange exception when I attempt this. The relevant controller code
and stack trace are below:

#controller
if not session.userForms:
    session.userForms = []
session.userForms.append(form)
#where form is an SQLFORM

Traceback (most recent call last):
  File "C:\Development\web2py\gluon\main.py", line 359, in wsgibase
    session._try_store_on_disk(request, response)
  File "C:\Development\web2py\gluon\globals.py", line 361, in
_try_store_on_disk
    cPickle.dump(dict(self), response.session_file)
  File "C:\Development\Python\lib\copy_reg.py", line 73, in _reduce_ex
    getstate = self.__getstate__
  File "C:\Development\web2py\gluon\sql.py", line 1173, in __getattr__
    return self[key]
  File "C:\Development\web2py\gluon\sql.py", line 1156, in __getitem__
    return dict.__getitem__(self, str(key))
KeyError: '__getstate__'

I've also noticed in the console warnings that pickling SQLObjects is
experimental. Is placing them in a session not possible? If so, what
would be the best alternative?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to