Hello
Lets define at db.py
db.define_table ('a',
SQLField('a'))
And lets insert to this table (not by web2py admin panel)
sqlite> insert into a values(0,0);
And then
def test():
return dict(message=db.a[0].a)
-----------
Will give:
Traceback (most recent call last):
File "gluon/restricted.py", line 173, in restricted
File "C:/!Work/web2py/applications/test/controllers/default.py",
line 51, in <module>
File "gluon/globals.py", line 96, in <lambda>
File "C:/!Work/web2py/applications/test/controllers/default.py",
line 13, in test
AttributeError: 'NoneType' object has no attribute 'a'
While asking db.a[1].a have no such error
Please tell, why 0 as id is so special?
I just use 0 for some default values, in mind they are not used yet
and ref to [0] annoing with error above.
Should I refuse use id=0 rows OR, could be some other way
Thank you for time.
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.