I've found out that the session file is always updated
(Session._try_store_in_file) if I access auth.user_groups. When the user is
logged in I'm iterating through auth.user_groups which modifies the session.
I've the following code:
if auth.user_id:
for role in auth.user_groups.itervalues():
...
when auth.user_groups.itervalues is called (or auth.user_groups.iteritems)
the session is changed. The reason is the pickled session (in
Session._unchanged) is different, although I've got no clue how this can
happen. I always thought itervalues does not change the dict.
I've made this small test:
if auth.user_id:
import cPickle as pickle
session_pickled1 = pickle.dumps(session, pickle.HIGHEST_PROTOCOL)
for role in auth.user_groups.itervalues():
continue
session_pickled2 = pickle.dumps(session, pickle.HIGHEST_PROTOCOL)
eq = (session_pickled1 == session_pickled2)
where eq is always False once auth.user_groups contains at least one item.
Is there any explanation for this?
Alex
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.