This code is part of a function:
session.about=db((db.NodeNav.nodeID==283)&(db.NodeNav.navID==db.Nav.id)&\
(db.Nav.navbarID==ABOUTNAVBARID)).select(db.Nav.name,db.NodeNav.nodeID)
print session.about
It prints:
Nav.name,NodeNav.nodeID
about,283
who_we_are,283
what_we_do,283
how_we_work,283
In the same function I have the following condition:
if not session.about or session.about[0].NodeNav.nodeID!=session.id:
... which 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
187, 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
63, in index
if not session.about or session.about[0].NodeNav.nodeID!=session.id:
AttributeError: 'dict' object has no attribute 'nodeID'
Why cannot I compare session.about[0].NodeNav.nodeID!=session.id ?
Kind regards,
Annet.
--