session is an Storage, Storages always return an attribute, defaults to
None.
You do not have to always access session objects by keys, you can do it by
attribute and it will always return an object, even if the object does not
exists.
examples
my_var = getattr(session, request.controller)
Even
In an index function I do something like
session[request.controller].something = 'foo'
This raises a key error exception on the first visit to the controller
after restarting the browser. Session can't find the controller name,
so I can't add an attribute to it. So I need to initialize the
sessi
2 matches
Mail list logo