On Jul 8, 2010, at 12:10 AM, mdipierro wrote:
> That is true...
>
> IS_IN_DB(db,'table.id', '%(name)s')
>
> when it build the list of options for
>
> <SELECT><OPTION value="{{=row.id}}">{{=name}}<OPTION>...</SELECT>
>
> name is '%(name)s' % row
>
> since row belongs to a class that extends dict.
IS_IN_DB() has a lot of undocumented options. Perhaps you could add something
to the source comment, as a start.
>
>
>
>
> On 8 Lug, 01:26, Jonathan Lundell <[email protected]> wrote:
>> On Jul 7, 2010, at 7:29 PM, Bruno Rocha wrote:
>>
>>> Open a Python terminal, and try this example
>>
>>>>>> d = {'id':1,'title':'web2py'}
>>>>>> d
>>> {'id': 1, 'title': 'web2py'}
>>>>>> "Title for id %(id)s is %(title)s " % d
>>> 'Title for id 1 is web2py '
>>
>> Unfortunately, none of this explains how the label argument is used in
>> IS_IN_DB(), nor is it explained in the manual. And I find the code pretty
>> opaque.
>>
>> How does the above relate to IS_IN_DB?
>>
>>> 2010/7/7 Bruno Rocha <[email protected]>:
>>>> Take a look to the String Formating and String Interpolation in Python
>>>> Documentation
>>
>>>> http://docs.python.org/library/stdtypes.html#string-formatting-operat...
>>
>>>> 2010/7/7 ra3don <[email protected]>:
>>>>> I apologize for a seemingly simple question, but what exactly does '%
>>>>> (title)s' do? I ran across it in the book in the wiki section, the
>>>>> whole line reads.
>>
>>>>> db.document.page_id.requires = IS_IN_DB(db, 'page.id', '%(title)s')
>>
>>>>> Thanks in advance,
>>
>>>>> ra3don.