On 27 Oct 2013, at 6:48 AM, Anthony <[email protected]> wrote:

> Perhaps the book should be clarified -- if you use named arguments, you have 
> to specify all three. If you specify only 1 argument, it assumes it should be 
> the function, and if you specify 2, it assumes it should be the controller 
> and function.

URL() has a long and complicated history, and this peculiar behavior is a 
consequence of that history. The original idea was that you'd call it with 
positional arguments for a,c,f, but as it sprouted more arguments, and became 
able to automatically reference request, it's become more "natural" to always 
specify argument names. 

This particular odd behavior could be fixed, and probably should be fixed. It'd 
cause backward compatibility problems for someone who actually wrote 
URL(a='functionname'), but I'd be surprised if that's happening; the intent was 
that you'd write URL('functionname') in that case.

[The fix I have in mind is to make the first three arguments of URL something 
like (acf1, acf2, acf3, ...) and push (a,c,f) into **kwargs.]


> 
> Anthony
> 
> On Sunday, October 27, 2013 6:17:26 AM UTC-4, Roland Kainrath wrote:
> Hi All,
> 
> I have a question about URL(). In the book it was written:
> "... It is also possible to specify application, controller and function 
> using named argument.
> URL(a='a', c='c', f='f') ..."
> 
> but for example when I write this:
> URL(a='myotherapp')
> 
> the generated URL comes like this:
> http://127.0.0.1:8000/init/default/myotherapp
> 
> but it should be like this:
> http://127.0.0.1:8000/myotherapp
> 
> Am I right?
> 
> Thank you for answering.
> 
> Regards:
> Roland
> 
> 

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

Reply via email to