Hi everyone. I'm having an issue with select() working after an
insert.
See below for what I'm doing:
zulu ~/web2py % ./web2py.py -S welcome
web2py Enterprise Web Framework
Created by Massimo Di Pierro, Copyright 2007-2010
Version 1.76.3 (2010-03-03 10:47:17)
Database drivers available: SQLite3
WARNING:root:import IPython error, use default python shell
Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> db=DAL('sqlite://test.db')
>>> db.define_table('test',Field('first','string'),Field('last','string'))
<CUT for readability>
>>> db().select(db.test.id>0)
<gluon.sql.Rows object at 0x1920ff0>
>>> db.test.insert(first='tara',last='birl')
1
>>> db().select(db.test.id>0)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/tara/web2py/gluon/sql.py", line 3056, in select
return self.parse(db,rows,self.colnames)
File "/Users/tara/web2py/gluon/sql.py", line 3073, in parse
field = table[fieldname]
File "/Users/tara/web2py/gluon/sql.py", line 1556, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'id>0'
>>> db.commit()
>>> db().select(db.test.id>0)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/tara/web2py/gluon/sql.py", line 3056, in select
return self.parse(db,rows,self.colnames)
File "/Users/tara/web2py/gluon/sql.py", line 3073, in parse
field = table[fieldname]
File "/Users/tara/web2py/gluon/sql.py", line 1556, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'id>0'
--
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.