web2py renders only functions that are not take parameters (it's useful to 
have a set of "protected" functions).
However, a "helper" is there for your situation

def something():
    id = request.args(0,default=0,cast=int,otherwise='http://error_url')


otherwise by default raises a HTTP(404), if is a string it 
redirects(there), if is a callable it gets executed

PS: nothing stops you to have a 
def somethingwithid(id=None):
      return 'something'

def this_is_the_page():
      return somethingwithid(request.args(0))




On Tuesday, April 23, 2013 9:43:54 PM UTC+2, Jurgis Pralgauskis 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 :)
>

-- 

--- 
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