smells fishy

--
Thadeus





On Sat, Jul 31, 2010 at 9:23 PM, mdipierro <mdipie...@cs.depaul.edu> wrote:
> You have db(...).select()
> This new syntax is a shortcut for  db().select().first()
>
> On 31 Lug, 20:40, Thadeus Burgess <thade...@thadeusb.com> wrote:
>> If there are multiple records we need to know about it =/
>>
>> --
>> Thadeus
>>
>>
>>
>> On Sat, Jul 31, 2010 at 11:36 AM, mdipierro <mdipie...@cs.depaul.edu> wrote:
>> > No. Only the first.
>>
>> > Massimo
>>
>> > On Jul 31, 10:50 am, David Marko <dma...@tiscali.cz> 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 <mdipie...@cs.depaul.edu> 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