I think is a bug, please report it:
http://code.google.com/p/web2py/issues/list
2011/9/7 Jim Steil <j...@qlf.com <mailto:j...@qlf.com>>
Hi
I'm getting the following:
Traceback(most recent call last):
File"C:\dev\trunk\web2py\gluon\restricted.py",line194,inrestricted
execccodeinenvironment
File"C:/dev/trunk/web2py/applications/FoodPantry/controllers/default.py"
<http://192.168.1.171:8000/admin/default/edit/FoodPantry/controllers/default.py>,line25,in<module>
File"C:\dev\trunk\web2py\gluon\globals.py",line145,in<lambda>
self._caller=lambdaf:f()
File"C:/dev/trunk/web2py/applications/FoodPantry/controllers/default.py"
<http://192.168.1.171:8000/admin/default/edit/FoodPantry/controllers/default.py>,line21,inpersons
form=SQLFORM.grid(db.person,ui='jquery-ui',paginate=20)
File"C:\dev\trunk\web2py\gluon\sqlhtml.py",line1655,ingrid
id=row[field_id]
File"C:\dev\trunk\web2py\gluon\dal.py",line3832,in__getitem__
returndict.__getitem__(self,m.group(1))[m.group(2)]
TypeError:'Set'objectisunsubscriptable
with the the following setup:
db.py
person = db.define_table('person',
Field('personId', 'id'),
Field('firstName', length=25, required=True, label='First Name'),
Field('lastName', length=25, required=True, label='Last Name'),
Field('address', 'text'),
Field('city', length=30),
Field('state', length=2),
Field('zipCode', length=10, label='ZIP Code'),
Field('phone', length=25),
Field('dob', 'date', label='Date of Birth'),
Field('sex', length=1),
Field('disability', length=50),
Field('singleParent', 'boolean', default=False, label='Single
Parent'),
Field('healthInsurance', length=50, label='Health Insurance'),
Field('origin', length=50),
Field('headOfHousehold', 'reference person', label='Head of
Household'),
Field('lastFirst', compute=lambda u: '%s, %s' % (u['lastName'],
u['firstName'])))
person.firstName.requires = IS_NOT_EMPTY()
person.lastName.requires = IS_NOT_EMPTY()
person.dob.requires = IS_DATE()
person.sex.requires = IS_IN_SET(['M', 'F'])
person.headOfHousehold.requires = IS_EMPTY_OR(IS_IN_DB(db, db.person,
'%(lastFirst)s',
zero='...choose one...'))
default.py
def persons():
form = SQLFORM.grid(db.person, ui='jquery-ui', paginate=20)
return dict(form=form)
Any thoughts?
-Jim
--
http://martin.tecnodoc.com.ar