[web2py] Re: URL based internationalization and pattern router

2016-08-07 Thread Anthony
On Sunday, August 7, 2016 at 2:21:19 AM UTC-4, Carlos Cesar Caballero wrote: > > Hi Anthony, first of all thanks for your time and your help. > > I think that getting data in controlers as vars, is far better than > recieving it as args, the main problem with your proposal (that works, of >

[web2py] Re: URL based internationalization and pattern router

2016-08-07 Thread Carlos Cesar Caballero
Hi Anthony, first of all thanks for your time and your help. I think that getting data in controlers as vars, is far better than recieving it as args, the main problem with your proposal (that works, of course) is the inconsistency in how we recive the data and how we send it (besides the fact

[web2py] Re: URL based internationalization and pattern router

2016-08-05 Thread Anthony
> Of course I will continue using web2py, but will be great if I could use > it without problems when my applications demands more exigent use cases. Of > course, the most of the people do not think like me and begin to use > another framework that works either with small and complicated >

[web2py] Re: URL based internationalization and pattern router

2016-08-04 Thread Anthony
> In that way we can move the code to a new application, and use a complete > different urls without change one single line of code. > Move what code to a new application? In web2py, you can also change the URLs without changing the application code, though as noted, in some cases, the route

[web2py] Re: URL based internationalization and pattern router

2016-08-04 Thread Anthony
On Sunday, July 31, 2016 at 5:31:47 PM UTC-4, Massimo Di Pierro wrote: > > Can you point to any other web framework that allows reverse mapping > path_info into query_string? > Looks like Yii does allow this. Its URL helper allows you to specify named parameters. Rather than putting all named

[web2py] Re: URL based internationalization and pattern router

2016-08-04 Thread Anthony
On Wednesday, August 3, 2016 at 2:00:08 AM UTC-4, Carlos Cesar Caballero wrote: > > Hi, first sorry for the late reply, but I am on vacations and offline most > of the time. > > Here is an example on how we use the Yii2 framework router: > > 'urlManager' => [ > 'class' =>

[web2py] Re: URL based internationalization and pattern router

2016-08-03 Thread Carlos Cesar Caballero
Hi, first sorry for the late reply, but I am on vacations and offline most of the time. Here is an example on how we use the Yii2 framework router: 'urlManager' => [ 'class' => \frontend\components\UrlManager::className(), 'enablePrettyUrl' => true,

[web2py] Re: URL based internationalization and pattern router

2016-07-31 Thread Massimo Di Pierro
Can you point to any other web framework that allows reverse mapping path_info into query_string? I am not aware of other frameworks that allow this. I would like to see what syntax they use. Massimo On Sunday, 31 July 2016 09:53:28 UTC-5, Carlos Cesar Caballero wrote: > > Many thanks for

[web2py] Re: URL based internationalization and pattern router

2016-07-31 Thread Anthony
On Sunday, July 31, 2016 at 10:53:28 AM UTC-4, Carlos Cesar Caballero wrote: > > the router should be completly independent from the app code, so any > changes on the router will not affect the app code, > What do you mean by this? Can you show how you configured the Yii router to generate the

[web2py] Re: URL based internationalization and pattern router

2016-07-31 Thread Anthony
On Sunday, July 31, 2016 at 2:39:17 AM UTC-4, Massimo Di Pierro wrote: > > This is a limitation with routes out. The left hand side cannot contain > "?" and vars. > You can maps path_info into request.vars in the way but not the vice versa > in the way out. You have to put the language in the

[web2py] Re: URL based internationalization and pattern router

2016-07-31 Thread Carlos Cesar Caballero
Many thanks for your answer Massimo. I hope that you accept my next words as a constructive criticism. Because of "little things" like this, so many developers do not like web2py, the router should be completly independent from the app code, so any changes on the router will not affect the app

[web2py] Re: URL based internationalization and pattern router

2016-07-31 Thread Massimo Di Pierro
This is a limitation with routes out. The left hand side cannot contain "?" and vars. You can maps path_info into request.vars in the way but not the vice versa in the way out. You have to put the language in the args and the do the remapping on the way out. On Friday, 29 July 2016 23:12:07

[web2py] Re: URL based internationalization and pattern router

2016-07-29 Thread Carlos Cesar Caballero
Hi everyone, again with problems with the router here, I have this rule in routes_in, and is working pefectly: ('/$lang/$country/$state/$city(?P.*)', '/{app}/city/view\g?lang=$lang=$country=$state=$city'.format(app=app)) This maps the url and I can use the language, the country, the city and

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-15 Thread Carlos Cesar Caballero Díaz
Hi Anthony, thanks for your suggestion, but I have more requeriments for the controllers and they will grow up, I think that your suggestion solves the problem, but in my case, the software will become dificult to maintain or extend in the future. Greetings. El 12/07/16 a las 15:02, Anthony

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-12 Thread Anthony
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. >

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-12 Thread Anthony
On Tuesday, July 12, 2016 at 9:46:22 AM UTC-4, Carlos Cesar Caballero wrote: > > Hi Anthony, unfortunately the parameter-based router doesn't suit my > needs, I need (among other things) the ability to map urls in that way: > > www.mysite.com/cuba to www.mysite.com/app/country/index/cuba >

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-12 Thread Carlos Cesar Caballero Díaz
Hi, thanks to everyone now I am able to write a pattern-based router for my application including basic internationalization by mapping the url data to a variable as Anthony suggests in his initial reply. Now I have two more questions: Can I replace the URL() function for my application

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-12 Thread Carlos Cesar Caballero Díaz
Hi Anthony, unfortunately the parameter-based router doesn't suit my needs, I need (among other things) the ability to map urls in that way: www.mysite.com/cuba to www.mysite.com/app/country/index/cuba www.mysite.com/cuba/cienfuegos to www.mysite.com/app/state/index/cuba/cienfuegos

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-12 Thread Carlos Cesar Caballero Díaz
Thanks Ron, is a very good and useful example. Greetings. El 11/07/16 a las 13:12, Ron Chatterjee escribió: Alternatively you can also look at this: http://www.web2pyref.com/example/routespy-url-rewrite-with-pattern-based-system-used-by-web2pyref-snippet-1 On Monday, July 11, 2016 at

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-12 Thread Massimo Di Pierro
There is one logical problem with the parameteric router (as opposed to the regex routes) and that is how it handles missing applicaiton/controller/function. If one is missing, it assumes a default value specified by the routes.py configuration. In this process it must make some assumptions

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-11 Thread Ron Chatterjee
Alternatively you can also look at this: http://www.web2pyref.com/example/routespy-url-rewrite-with-pattern-based-system-used-by-web2pyref-snippet-1 On Monday, July 11, 2016 at 12:19:18 PM UTC-4, Anthony wrote: > > Alternatively, you can see if the parameter-based rewrite system will suit >

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-11 Thread Anthony
Alternatively, you can see if the parameter-based rewrite system will suit your needs, as it includes built-in support for language in the URL. Or you can track the user's chosen language via a cookie rather than the URL (doesn't help with bookmarking, though). Anthony On Monday, July 11,

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-11 Thread Anthony
On Monday, July 11, 2016 at 11:46:54 AM UTC-4, Carlos Cesar Caballero wrote: > > And he can't?? wait, I am lost. > > I need from some url like that: > > www.mysite.com/lang/ > or > www.mysite.com/lang/blog > or > www.mysite.com/lang/category > > to get 'lang' > and do something like: > var =

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-11 Thread Carlos Cesar Caballero Díaz
And he can't?? wait, I am lost. I need from some url like that: www.mysite.com/lang/ or www.mysite.com/lang/blog or www.mysite.com/lang/category to get 'lang' and do something like: var = get_lang() and late do: T.force(var) But how can I get lang? PD: i can't even make the pattern-bassed

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-11 Thread Anthony
On Monday, July 11, 2016 at 8:55:52 AM UTC-4, Carlos Cesar Caballero wrote: > > Thanks Anthony, I'll work in that, in my opinion the router is a very > important feature. > Note, I think the grid would preserve a URL var, and you could explicitly configure it to preserve a URL arg as well. I

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-11 Thread Carlos Cesar Caballero Díaz
Thanks Anthony, I'll work in that, in my opinion the router is a very important feature. Greetings. El 07/07/16 a las 11:59, Anthony escribió: For incoming URLs, you could map the language to a URL arg or query string variable. For outgoing URLs, you could either set that same URL arg or var

[web2py] Re: URL based internationalization and pattern router

2016-07-07 Thread Anthony
For incoming URLs, you could map the language to a URL arg or query string variable. For outgoing URLs, you could either set that same URL arg or var and rely on a routes_out rewrite rule, or you could simply prepend URLs generated via the URL() function with the language. In either case, you

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-07 Thread Carlos Cesar Caballero Díaz
Hi, thanks for answer my question, but this is the parameter-based router, I need to use the pattern-based one. (http://web2py.com/books/default/chapter/29/04/the-core?search=routes#Pattern-based-system) Greetings. El 07/07/16 a las 09:28, Marlysson Silva escribió: This not work?

[web2py] Re: URL based internationalization and pattern router

2016-07-07 Thread Marlysson Silva
This not work? http://web2py.com/books/default/chapter/29/04/the-core?search=routes#URL-rewrite Using a languages dictionary , or setting a default language routers = dict( BASE = dict(default_application='myapp'), myapp = dict(languages=['en', 'it', 'jp'], default_language='en'),) Em