On Tuesday, July 12, 2016 at 12:14:29 PM UTC-4, Carlos Cesar Caballero 
wrote:
>
> Now I have two more questions:
>

First, see my other response, as you might be able to restructure your 
web2py controller(s) to enable you to use the parameter-based router and 
avoid all of this complexity.
 

> Can I replace the URL() function for my application without rewrite the 
> framework code?
>

You might be better off writing your own url() function and simply calling 
URL() from it. Alternatively, I suppose you could monkey patch the 
framework's URL() function (it is in gluon.html). You could do the monkey 
patching from routes.py, which is executed once when the web server first 
starts (unless you explicitly reload routes via Admin).
 

> And second, I want to go forward and implement a default language in the 
> router if there is none in the url, for example:
>
> www.mysite.com/blog
> for the spanish blog page
> and
> www.mysite.com/en/blog
> www.mysite.com/fr/blog
> for english, french etc..
>

That makes the routes regex more tricky. I suppose you would have to change 
the regex so it explicitly looks for all of the possible language codes 
(rather than just assuming the first segment of the URL path is always a 
language code).

Anthony

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to