I am having difficulty storing a simple (non-SQL) object in the
session. I wondered if anyone could give me a clue as to why. The
following works:
def update_profile():
if (session.sections!=None):
session.sections=None
return dict(sections='spam')
else:
session.sections={}
#x = testClass()
x = 'eggs'
session.sections=x
return dict(sections=`x`)
class testClass:
pass
with a toggling result on successive reloads of:
' e g g s '
<<RELOAD THE PAGE>>
s p a m
...
However if I swap the two lines as below:
def update_profile():
if (session.sections!=None):
session.sections=None
return dict(sections='spam')
else:
session.sections={}
x = testClass()
#x = 'eggs'
session.sections=x
return dict(sections=`x`)
class testClass:
pass
The result fails to toggle:
<__b u i l t i n__.testClassinstanceat0xab18ccc>
<<RELOAD THE PAGE>>
<__b u i l t i n__.testClassinstanceat0xab094cc>
...
Which appears that the object doesn't ever actually store into the
session. I searched the group and from what I can tell this is
possible, but I can't figure out what I'm doing wrong.
Thanks in advance!
-- Lesh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---