Right -- the first argument to auth.requires is "condition", which can
either be something that evaluates to True or False or a single callable.
On Thursday, March 8, 2012 2:13:33 PM UTC-5, Richard wrote:
>
> And only need one lambda :
>
> #WORKS
> @auth.requires(lambda: auth.has_membership('group1') or
> auth.has_membership('group2'))
>
>
> # First aptemp NOT WORKING
> @auth.requires(lambda: auth.has_membership('group1') or lambda:
> auth.has_membership('group2'))
>
> :)
>
> Richard
>
> On Thu, Mar 8, 2012 at 2:04 PM, Anthony <[email protected]> wrote:
>
>> Good point -- if your auth.requires(...) includes conditions that do
>> database hits, it is better to put the conditions inside a lambda so the db
>> hits only happen when the decorated action is actually called and not every
>> time the controller is loaded (i.e., when other actions within the
>> controller are called).
>>
>> Anthony
>>
>>
>> On Thursday, March 8, 2012 1:44:31 PM UTC-5, Richard wrote:
>>>
>>> With lambda is better for speed :
>>> https://groups.google.com/**forum/#!msg/web2py/**
>>> A0z8DSZdYTo/H_1N6_4MZfEJ<https://groups.google.com/forum/#!msg/web2py/A0z8DSZdYTo/H_1N6_4MZfEJ>
>>>
>>> Richard
>>>
>>> On Thu, Mar 8, 2012 at 4:09 AM, Annet <[email protected]> wrote:
>>>
>>>> Hi Bruno,
>>>>
>>>> Thanks for your reply.
>>>>
>>>>
>>>> Kind regards,
>>>>
>>>> Annet
>>>
>>>
>>>
>