On Thursday, June 4, 2015 at 1:00:54 PM UTC-7, Alex Glaros wrote:
>
> what is syntax for adding vars to direct call to a function?
>
> def my_controller()
>    do_anything
>    reusable_find_person_and_return_their_value(), vars=request.vars # how 
> do I specify vars here on this line?
>    do_anything_else
>    return locals()
>
> I tried:
>
>     reusable_find_person_and_return_their_value, vars=request.vars()
>     reusable_find_person_and_return_their_value(vars=request.vars)
>     reusable_find_person_and_return_their_value(=request.vars)
>
> thanks,
>

Is  reusable_find_person_and_return_their_value() another controller 
function, or is it a helper function?  If it is a helper function, the def 
line should list the parameters it expects.

def reusable_find_person_and_return_their_value(pername, haircolor):

for instance.  Then you'd call it in the usual (python) way:
reusable_find_person_and_return_their_value(req.vars.pername, req.vars.
haircolor):

If you want to pass in all of req.vars, instead of specific values, I think 
you get into the "**" notation in the def.

/dps



> Alex 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to