On Sunday, October 30, 2011 1:44:47 AM UTC-4, viniciusban wrote:
>
> In the book there's this comments about it:
>
> [cite]
> Most attributes of fields and tables can be modified after they are
> defined:
>
> db.define_table('person',Field('name',default=''),format='%(name)s')
> db.person._format = '%(name)s/%(id)s'
>
You can make the above work by preceding that last line with:
db.person.pop('_format')
That will remove the '_format' key from db.person, which will then allow
you to add a new one. Note, you can't do del db.person['_format'] because
in that case it thinks you are trying to access a record in the db.person
table (nor del db.person._format, because it won't recognize _format as an
attribute, since technically it is a dict key).
Anyway, perhaps we should enable keys that start with _ to be changed
(which is the case with DAL objects).
Anthony