On Sunday, May 8, 2011 7:25:26 AM UTC-4, niknok wrote:
>
> Massimo (or anyone who'd like to pitch in)
>
> You made this suggestion when I asked a question about a "help system".
>
> Field('name',...)
> db.table.name.help = 'custom attribute'
>
> I think the idea above is that you can add arbitrary attributes to any
Field object and use them for whatever purpose you need.
>
> Also, I was reading the code of register_other() of conf2py, and I found
> these 2 lines that I don't quite understand:
>
> db.auth_user.registered_by.default=auth.user.id
> record=db.auth_user(request.args(0) or 0,registered_by=auth.user.id)
>
> Why is"registered_by=auth.user.id" supplied when it's already preceded by
> a line that tells the database that it should use auth.user.id as the
> default value. And I don't recall reading this convention of assigning
> values to a record being retrieved.
>
The above is not assigning a value to registered_by -- it is simply a
shortcut way to do a query to retrieve a record (registered_by=auth.user.id
is a condition that must be met). See
http://web2py.com/book/default/chapter/06#Fetching-a-Row.
Anthony