On 23 Apr 2013, at 12:43 PM, Jurgis Pralgauskis <[email protected]> 
wrote:
> Hi, 
> 
> if I define controller with parameters, 
> 
> def stuff(id=None):
>     id = id or int(request.args(0))
>     return dict(info=db.stuff(id).info)
> 
> I get this message on page: 
> invalid function (default/stuff)
> 
> though it would be possible (and convenient for me) to call it either:
> a)  directly 
> b) via URL/LOAD...
> 
> Now I have to always LOAD it...
> 
> By the way, I could even do:
> def stuff(id=int(request.args(0))):
>     return dict(info=db.stuff(id).info) 
> 
> or maybe there could be some decorator shortcut, which could turn any 
> function with parameters to consume request.arguments (and become possible 
> controller)?
> as writing  int(request.args(0)) each time is somewhat too repetitive :)
> 
> -- 
>  


Controllers may not have arguments.

you might write:

def _stuff(id=None):
    ...

def stuff():
    _stuff(request.args(0))

-- 

--- 
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/groups/opt_out.


Reply via email to