If there are multiple records we need to know about it =/

--
Thadeus





On Sat, Jul 31, 2010 at 11:36 AM, mdipierro <[email protected]> wrote:
> No. Only the first.
>
> Massimo
>
> On Jul 31, 10:50 am, David Marko <[email protected]> wrote:
>> ### print db.person(name='john')
>> Does it also return many items when many items matches the condition?
>>
>> David
>>
>> On 31 čnc, 13:57, mdipierro <[email protected]> wrote:
>>
>> > given
>>
>> >   db.define_table('person',Field('name'))
>> >   id = db.person.insert(name='john')
>>
>> > You can now do
>>
>> >   print db.person(id)
>> >   print db.person(db.person.name=='john')
>> >   print db.person(name='john')
>> >   print db.person(id,name='john')
>>
>> > they all return the same record 'john'. On failure (record does not
>> > exist) they return None. This allows the following syntax:
>>
>> >   record = db.person(request.args(0)) or redirect(URL('error'))
>>
>> > this is better than
>>
>> >   record = db.person[request.args(0)] or redirect(URL('error'))
>>
>> > since the latter raises an exception in case request.args(0) is not
>> > None or an int.
>

Reply via email to