mdipierro
unread,Nov 29, 2009, 11:49:46 AM11/29/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to web2py-users
I have added some stuff in trunk.
1)
reference fields now have a default IS_IN_DB validator
notull=True have a default IS_NOT_EMPTY validator
unique=True have a default IS_NOT_IN_DB validator
db.define_table('person',Field('name'), format='%(name)s')
will give all references to to a person a
db.person.represent = lambda id: '%(name)s' % db.person[id]
so persons are always represented by a person name (in crud.read and
tables).
This is done in backward compatible way but it will change the default
look of forms and tables if you have not defined reference validators
and table.represent.
Now you can just do:
db.define_table('person',Field('name',unique=True), format='%(name)s')
db.define_table('dog',Field('name',unique=True),Field
('owner',db.person), format='%(name)s')
and everything will have default validators.
2) before you could loop over tablename and fieldname
for tablename in db.tables
for fieldname in table.fields
now you can loop also over fields
for table in db
for field in table
Please try them to make sure nothing is broken.
Massimo