>
> # I think this should work: 
> if 'column_select_value' in session[request.controller].keys(): 
>         column_select_value = 
> session[request.controller].column_select_value 
>
> # But I get this: 
> AttributeError: 'dict' object has no attribute 'column_select_value'
>

In Python, you cannot access dict items that way -- it would have to be:

session[request.controller]['column_select_value']

Or you could do:
from gluon.storage import Storage
session[request.controller] = Storage()

Then you can use session[request.controller].column_select_value, and you 
don't even have to test whether "column_select_value" is one of the keys -- 
Storage objects simply return None when you try to access a key that 
doesn't exist.

Also, side note -- with a Python dict, instead of "if 'mykey' in 
mydict.keys()" you can just do "if 'mykey' in mydict".

Anthony

Reply via email to