web2py on this particular matter needs to be pretty dumb exactly because 
pretty much anything can be serialized into the session.
Sessions are also not hookable, so you can't even write your own 
serializer....
any other framework restricts serialization to a plain dict (serialized as 
json) OR allows you to store whatever you want given you signal at every 
time you modify session MANUALLY. 
There's no way around it, unfortunately.

On Tuesday, March 15, 2016 at 8:32:27 PM UTC+1, Anthony wrote:
>
> On Tuesday, March 15, 2016 at 1:36:19 PM UTC-4, Alex wrote:
>>
>> Do you know why there is a difference if the dict is accessed inside or 
>> outside a controller function?
>>
>> Are there any (fast) alternatives to calculate a dict hash?
>>
>
> Are you looking for an alternative way to hash the session? The problem is 
> the session currently allows any pickleable object, so we can't pick a 
> serialization format that excludes anything pickleable (e.g., JSON would 
> not work). 
>  
>
>> The workaround for me would be to not access auth.user_groups and use 
>> fields in the user table instead (e.g. auth.user.is_admin) which does not 
>> change the session. If there is no good solution and the code stays 
>> unchanged I think this should definitely be mentioned in the book. If there 
>> are many requests the performance loss is probably not insignificant since 
>> the session is written for every request.
>>
>
> Any ideas?
>
> Anthony 
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to