I have the following lines of code:

aboutnav=db((db.NodeNav.nodeID==id)&(db.NodeNav.navID==db.Nav.id)&(db.Nav.navbarID==ABOUTNAVBARID)).select(db.Nav.ALL,db.NodeNav.ALL,orderby=db.Nav.position).as_list()
if aboutnav:
    session[id].aboutnav=True
    for r in aboutnav:
        if r['Nav']['id']==ABOUTNAVID and r['NodeNav']['frontend']:
            session[id].site_menu.append([T(r['Nav']['name']),False,'#'])
        elif r['NodeNav']['frontend']:
            session[id].about_dropdown.append([T(r['Nav']['name']),False, 
URL(r['Nav']['frontendcontroller'],r['Nav']['function'],args=id)])
            session[id].r['Nav']['function']=True

The last line results in the following error:

Traceback (most recent call last):
  File "/Library/Python/2.5/site-packages/web2py/gluon/restricted.py", line 
205, in restricted
    exec ccode in environment
  File 
"/Library/Python/2.5/site-packages/web2py/applications/bootstrap/controllers/site.py"
 <http://127.0.0.1:8000/admin/default/edit/bootstrap/controllers/site.py>, line 
194, in <module>
  File "/Library/Python/2.5/site-packages/web2py/gluon/globals.py", line 173, 
in <lambda>
    self._caller = lambda f: f()
  File 
"/Library/Python/2.5/site-packages/web2py/applications/bootstrap/controllers/site.py"
 <http://127.0.0.1:8000/admin/default/edit/bootstrap/controllers/site.py>, line 
83, in index
    session[id].r['Nav']['function']=True
TypeError: 'NoneType' object is unsubscriptable


Why can I do session[id].plural=True and can't I do 
session[id].r['Nav']['function']=True


Annet


-- 



Reply via email to