On 28 Mar 2014, at 6:35 AM, villas <[email protected]> wrote: > >>> URL(a='a',c='c',f='f') > '/a/c/f' > > >>> URL(a='a',c=' ',f=' ') > '/a/ / ' > > >>> URL(a='a') > '/APPNAME/a' > > >>> URL(a='a',c='',f='') > '/APPNAME/a' > > > In the last two commands, APPNAME appears. Why? That's looks like a bug. > > @Jonathan, I cannot see why URL() cannot generate external urls in > principle. Otherwise why have scheme and host arguments?
We added those primarily to generate absolute URLs for use in (for example) emails and other external references to web2py-generated pages, and to override hostnames in some odd cases of multiple-domain sites (IIRC). It's not that you might not be able to induce it to make external URLs, but it doesn't make it easy, and the interactions with routing on the outgoing side could be hard to predict. The thing is, it's harder to force URL to do the right thing here than it is to use the standard Python library to do the encoding correctly. If we really wanted to wrap those functions, and allow the use of constructs like args and vars in the URL's construction, it'd be better to write another wrapper. Call it XURL for external URL. -- 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.

