I have a router function in which I have the following lines of code:
session[id]=Storage(id=id)
session[id].accountID=ADVANCEDACCOUNTID
session[id].pluralID=account.pluralID
redirect(URL('site','index',args=id))
in site/index/id I store settings in session[id]:
if not session[id].sitenav:
retrieve setting and store in session[id]
....
session[id].sitenav=True
if not session[id].aboutnav
....
etc.
In a cms users can change these settings, to make these changes visible in
site/index/id I thought I could do:
form=crud.update(table=db.nodeNav,record=row,onaccept=onaccept_functions,deletable=False)
def onaccept_functions(form):
id=get_ID(auth,session)
if session[id]:
if session[id].sitenav:
session[id].sitenav=False
if session[id].aboutnav:
session[id].aboutnav=False
However, session[id].sitenav results in an attribute error:
AttributeError: 'NoneType' object has no attribute 'sitenav'
I don't understand why, site/index/6 displays the index page and allows me
to navigate through the application based on id=6. {{=session}} in a view
shows the content of session including sitenav=True, but {{=session[6]}}
displays None.
Is there an other way to have the index function reset the settings?
Kind regards,
Annet.
--