Now that I think about it, this has already been fixed in trunk. In trunk, 
you should be able to do:

db.person._format='whatever'

without having to first delete _format. That will work for any table 
attribute starting with an underscore, including the new _singular and 
_plural attributes (which are used as singular and plural table labels).

Anthony

On Sunday, October 30, 2011 2:51:42 AM UTC-4, viniciusban wrote:
>
> Thank you.
>
> It worked. :-)
>
> I think it would be nice to update book to document it, right?
>
> On Sun, Oct 30, 2011 at 4:24 AM, Anthony <abas...@gmail.com> wrote:
> > 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
>
>

Reply via email to