Re: [web2py] Re: Trying to reach a routes behavior

2016-03-29 Thread Carlos Cesar Caballero Díaz

Many thanks Anthony and Richard, I'll use your suggestion.

Greetings.

El 29/03/16 a las 10:27, Richard Vézina escribió:
I agree with Anthony... Do you have any constraint that prevent you 
from doing that... I would definetly stay away from router as much as 
I can...


Richard

On Tue, Mar 29, 2016 at 9:37 AM, Anthony > wrote:


Right now the url to reach the index function of the country
controller is something like www.myapp.com/country/cuba
 because index is set as
the default function using the parametric router
(www.myapp.com/country/index/cuba
 without set index()
as default).


Now I need to find a way to map

www.myapp.com/country/index/cuba
 from
www.myapp.com/cuba 
www.myapp.com/state/index/cuba/cienfuegos
 from
www.myapp.com/cuba/cienfuegos

www.myapp.com/city/index/cuba/cienfuegos/cienfuegos

from www.myapp.com/cuba/cienfuegos/cienfuegos



I don't think you want to use URL rewrite rules to achieve this,
as it will be very complex to set up and maintain. Given the above
requirements, I think my earlier proposal makes much more sense --
just have a single controller with a single function:

|
defindex():
country,state,city
=request.args(0),request.args(1),request.args(2)
ifcity:
data =get_city_data(country,state,city)
response.view ='default/city_view.html'
elifstate:
data =get_state_data(country,state)
response.view ='default/state_view.html'
elifcountry:
data =get_country_data(country)
response.view ='default/country_view.html'
...
|

Of course, the details of you implement the internal logic will
depend on exactly how different the code is for country vs. state
vs. city.

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.


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




--
Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

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


Re: [web2py] Re: Trying to reach a routes behavior

2016-03-29 Thread Richard Vézina
I agree with Anthony... Do you have any constraint that prevent you from
doing that... I would definetly stay away from router as much as I can...

Richard

On Tue, Mar 29, 2016 at 9:37 AM, Anthony  wrote:

> Right now the url to reach the index function of the country controller is
>> something like www.myapp.com/country/cuba because index is set as the
>> default function using the parametric router (
>> www.myapp.com/country/index/cuba without set index() as default).
>>
>
>> Now I need to find a way to map
>>
>> www.myapp.com/country/index/cuba from www.myapp.com/cuba
>> www.myapp.com/state/index/cuba/cienfuegos from
>> www.myapp.com/cuba/cienfuegos
>> www.myapp.com/city/index/cuba/cienfuegos/cienfuegos from
>> www.myapp.com/cuba/cienfuegos/cienfuegos
>>
>
> I don't think you want to use URL rewrite rules to achieve this, as it
> will be very complex to set up and maintain. Given the above requirements,
> I think my earlier proposal makes much more sense -- just have a single
> controller with a single function:
>
> def index():
> country, state, city = request.args(0), request.args(1), request.args(
> 2)
> if city:
> data = get_city_data(country, state, city)
> response.view = 'default/city_view.html'
> elif state:
> data = get_state_data(country, state)
> response.view = 'default/state_view.html'
> elif country:
> data = get_country_data(country)
> response.view = 'default/country_view.html'
> ...
>
> Of course, the details of you implement the internal logic will depend on
> exactly how different the code is for country vs. state vs. city.
>
> 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.
>

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


Re: [web2py] Re: Trying to reach a routes behavior

2016-03-29 Thread Anthony

>
> Right now the url to reach the index function of the country controller is 
> something like www.myapp.com/country/cuba because index is set as the 
> default function using the parametric router (
> www.myapp.com/country/index/cuba without set index() as default).
>

> Now I need to find a way to map
>
> www.myapp.com/country/index/cuba from www.myapp.com/cuba
> www.myapp.com/state/index/cuba/cienfuegos from 
> www.myapp.com/cuba/cienfuegos
> www.myapp.com/city/index/cuba/cienfuegos/cienfuegos from 
> www.myapp.com/cuba/cienfuegos/cienfuegos
>

I don't think you want to use URL rewrite rules to achieve this, as it will 
be very complex to set up and maintain. Given the above requirements, I 
think my earlier proposal makes much more sense -- just have a single 
controller with a single function:

def index():
country, state, city = request.args(0), request.args(1), request.args(2)
if city:
data = get_city_data(country, state, city)
response.view = 'default/city_view.html'
elif state:
data = get_state_data(country, state)
response.view = 'default/state_view.html'
elif country:
data = get_country_data(country)
response.view = 'default/country_view.html'
...

Of course, the details of you implement the internal logic will depend on 
exactly how different the code is for country vs. state vs. city.

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.


Re: [web2py] Re: Trying to reach a routes behavior

2016-03-29 Thread Carlos Cesar Caballero Díaz
Hi Anthony and Richard, these are the functions of my country controller 
(state and city controllers are similar):


def index()
def edit()

In the future the controller will have more functions (we have planned 
new features that will be built as components)


There is no a cuba() function, in index() I have something like:

country = request.args[0]

In the index() functions of the other controllers I get the extra args.

Right now the url to reach the index function of the country controller 
is something like www.myapp.com/country/cuba because index is set as the 
default function using the parametric router 
(www.myapp.com/country/index/cuba without set index() as default).


Now I need to find a way to map

www.myapp.com/country/index/cuba from www.myapp.com/cuba
www.myapp.com/state/index/cuba/cienfuegos from www.myapp.com/cuba/cienfuegos
www.myapp.com/city/index/cuba/cienfuegos/cienfuegos from 
www.myapp.com/cuba/cienfuegos/cienfuegos


Sorry, I was not so clear before...

Greetings.


El 28/03/16 a las 15:15, Anthony escribió:
On Monday, March 28, 2016 at 1:20:59 PM UTC-4, Carlos Cesar Caballero 
wrote:


They provide related but different information with a different
structure (country show main country info, an basic States and
Cities info and so on), The separate country, city, and state
controller files are not strictly needed, but I prefer to maintain
the code structure for extensibility and maintainability. The
controllers have other functions that can be accessed in the
classical way.


Still not sure I follow. What exactly is in your country.py 
controller? Do you literally have a cuba() function? Are there 
functions for other countries, and if so, how do they differ from the 
cuba() function? What is in the city.py controller? Is there a 
function for each city?


I'm guessing it would make more sense to have the /default/index 
function accept up to three URL args specifying the country and 
(optionally) the state and city. Then you would have logic in that 
function to call the appropriate functions, which can reside in 
modules and be imported. But it's hard to say without knowing what you 
are really trying to do.


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.




--
Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

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


Re: [web2py] Re: Trying to reach a routes behavior

2016-03-28 Thread Anthony
On Monday, March 28, 2016 at 1:20:59 PM UTC-4, Carlos Cesar Caballero wrote:
>
> They provide related but different information with a different structure 
> (country show main country info, an basic States and Cities info and so 
> on), The separate country, city, and state controller files are not 
> strictly needed, but I prefer to maintain the code structure for 
> extensibility and maintainability. The controllers have other functions 
> that can be accessed in the classical way.
>

Still not sure I follow. What exactly is in your country.py controller? Do 
you literally have a cuba() function? Are there functions for other 
countries, and if so, how do they differ from the cuba() function? What is 
in the city.py controller? Is there a function for each city?

I'm guessing it would make more sense to have the /default/index function 
accept up to three URL args specifying the country and (optionally) the 
state and city. Then you would have logic in that function to call the 
appropriate functions, which can reside in modules and be imported. But 
it's hard to say without knowing what you are really trying to do.

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.


Re: [web2py] Re: Trying to reach a routes behavior

2016-03-28 Thread Richard Vézina
I don't understand Carlos, do you have a "cuba" controller/function in
country/state/city controller files? Are you going to create a function for
any given possible contry (+192)? There will be a lot of duplicated code...

Why don't you have a location.py controller file with a contry/state/city
function as you seems to need and have... Then use args for the rest as it
make more sens anyway...

Something like that :

yourapp/location/country/cuba
yourapp/location/state/cuba/cienfuegos
yourapp/location/city/cuba/cienfuegos/cienfuegos


Or you can use vars :

yourapp/location/your_functions?country=cuba&state=cienfuegos&city=cienfuegos

Richard

On Mon, Mar 28, 2016 at 1:22 PM, Carlos Cesar Caballero Díaz <
desarro...@spicm.cfg.sld.cu> wrote:

> They provide related but different information with a different structure
> (country show main country info, an basic States and Cities info and so
> on), The separate country, city, and state controller files are not
> strictly needed, but I prefer to maintain the code structure for
> extensibility and maintainability. The controllers have other functions
> that can be accessed in the classical way.
>
>
>
> El 28/03/16 a las 11:59, Anthony escribió:
>
> What is the nature of these controllers and the functions they contain? Do
> you really need separate country, city, and state controller files, or
> could you instead have a single function in a single controller that
> retrieves data for a given country, city, state depending on the set of URL
> args?
>
> Anthony
>
> On Monday, March 28, 2016 at 11:46:18 AM UTC-4, Carlos Cesar Caballero
> wrote:
>>
>> Hi Antony, I was not clear enough... I have a country controller with a
>> default index function, and the same with a state controller and a city
>> controller, so right now:
>>
>> if I call www.myapp.com/country/cuba I get my country page for Cuba (the
>> index function of country controller with cuba as parameter)
>> if I call www.myapp.com/state/cuba/cienfuegos I get my state page for
>> Cienfuegos, Cuba state (the index function of state controller with cuba
>> and cienfuegos as parameter)
>> and if I call www.myapp.com/city/cuba/cienfuegos/cienfuegos I get my
>> city page for Cienfuegos, Cienfuegos, Cuba city (the index function of city
>> controller with cuba, cienfuegos, and cienfuegos as parameter)
>>
>> I need to find a way to map directly to such pages without specify
>> country, state or city controllers depending of the number of params.
>>
>> Greetings.
>>
>> El 28/03/16 a las 10:59, Anthony escribió:
>>
>> I think there is some confusion of terminology. In web2py, a controller
>> is a file in the /controllers folder, and each function in that file is an
>> action reachable via an HTTP request. A view is not executed independently
>> but associated with a particular function in a controller. With this
>> terminology in mind, can you detail your set of controllers and functions
>> and then explain how you want URLs to map to those controllers and
>> functions?
>>
>> Anthony
>>
>> On Monday, March 28, 2016 at 9:18:15 AM UTC-4, Carlos Cesar Caballero
>> wrote:
>>>
>>> Hi, I am trying to reach a routes behavior for an app but I can´t, so I
>>> need some tips...
>>>
>>> I have in my app countries, cities and states (or province), countries
>>> have states and states have cities. Each une of them have its own
>>> controller and view, and I want the next behavior:
>>>
>>> www.myapp.com/cuba - run country conntroller and view (for Cuba
>>> country)
>>> www.myapp.com/cuba/cienfuegos - run state conntroller and view (for
>>> Cienfuegos state of Cuba country)
>>> www.myapp.com/cuba/cienfuegos/cienfuegos - run city conntroller and
>>> view
>>> (for Cienfuegos city, Cienfuegos state of Cuba country)
>>>
>>> I will higly appreciate any help with this.
>>>
>>> Greetings.
>>>
>>> --
>>> Este mensaje le ha llegado mediante el servicio de correo electronico
>>> que ofrece Infomed para respaldar el cumplimiento de las misiones del
>>> Sistema Nacional de Salud. La persona que envia este correo asume el
>>> compromiso de usar el servicio a tales fines y cumplir con las regulaciones
>>> establecidas
>>>
>>> Infomed: http://www.sld.cu/
>>>
>>> --
>> 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.
>>
>>
>> --
> 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-

Re: [web2py] Re: Trying to reach a routes behavior

2016-03-28 Thread Carlos Cesar Caballero Díaz
They provide related but different information with a different 
structure (country show main country info, an basic States and Cities 
info and so on), The separate country, city, and state controller files 
are not strictly needed, but I prefer to maintain the code structure for 
extensibility and maintainability. The controllers have other functions 
that can be accessed in the classical way.




El 28/03/16 a las 11:59, Anthony escribió:
What is the nature of these controllers and the functions they 
contain? Do you really need separate country, city, and state 
controller files, or could you instead have a single function in a 
single controller that retrieves data for a given country, city, state 
depending on the set of URL args?


Anthony

On Monday, March 28, 2016 at 11:46:18 AM UTC-4, Carlos Cesar Caballero 
wrote:


Hi Antony, I was not clear enough... I have a country controller
with a default index function, and the same with a state
controller and a city controller, so right now:

if I call www.myapp.com/country/cuba
 I get my country page for Cuba
(the index function of country controller with cuba as parameter)
if I call www.myapp.com/state/cuba/cienfuegos
 I get my state page
for Cienfuegos, Cuba state (the index function of state controller
with cuba and cienfuegos as parameter)
and if I call www.myapp.com/city/cuba/cienfuegos/cienfuegos
 I get my
city page for Cienfuegos, Cienfuegos, Cuba city (the index
function of city controller with cuba, cienfuegos, and cienfuegos
as parameter)

I need to find a way to map directly to such pages without specify
country, state or city controllers depending of the number of params.

Greetings.

El 28/03/16 a las 10:59, Anthony escribió:

I think there is some confusion of terminology. In web2py, a
controller is a file in the /controllers folder, and each
function in that file is an action reachable via an HTTP request.
A view is not executed independently but associated with a
particular function in a controller. With this terminology in
mind, can you detail your set of controllers and functions and
then explain how you want URLs to map to those controllers and
functions?

Anthony

On Monday, March 28, 2016 at 9:18:15 AM UTC-4, Carlos Cesar
Caballero wrote:

Hi, I am trying to reach a routes behavior for an app but I
can´t, so I
need some tips...

I have in my app countries, cities and states (or province),
countries
have states and states have cities. Each une of them have its
own
controller and view, and I want the next behavior:

www.myapp.com/cuba  - run country
conntroller and view (for Cuba country)
www.myapp.com/cuba/cienfuegos
 - run state
conntroller and view (for
Cienfuegos state of Cuba country)
www.myapp.com/cuba/cienfuegos/cienfuegos
 - run city
conntroller and view
(for Cienfuegos city, Cienfuegos state of Cuba country)

I will higly appreciate any help with this.

Greetings.

-- 
Este mensaje le ha llegado mediante el servicio de correo

electronico que ofrece Infomed para respaldar el cumplimiento
de las misiones del Sistema Nacional de Salud. La persona que
envia este correo asume el compromiso de usar el servicio a
tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

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


--
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://g

Re: [web2py] Re: Trying to reach a routes behavior

2016-03-28 Thread Anthony
What is the nature of these controllers and the functions they contain? Do 
you really need separate country, city, and state controller files, or 
could you instead have a single function in a single controller that 
retrieves data for a given country, city, state depending on the set of URL 
args?

Anthony

On Monday, March 28, 2016 at 11:46:18 AM UTC-4, Carlos Cesar Caballero 
wrote:
>
> Hi Antony, I was not clear enough... I have a country controller with a 
> default index function, and the same with a state controller and a city 
> controller, so right now:
>
> if I call www.myapp.com/country/cuba I get my country page for Cuba (the 
> index function of country controller with cuba as parameter)
> if I call www.myapp.com/state/cuba/cienfuegos I get my state page for 
> Cienfuegos, Cuba state (the index function of state controller with cuba 
> and cienfuegos as parameter)
> and if I call www.myapp.com/city/cuba/cienfuegos/cienfuegos I get my city 
> page for Cienfuegos, Cienfuegos, Cuba city (the index function of city 
> controller with cuba, cienfuegos, and cienfuegos as parameter)
>
> I need to find a way to map directly to such pages without specify 
> country, state or city controllers depending of the number of params.
>
> Greetings.
>
> El 28/03/16 a las 10:59, Anthony escribió:
>
> I think there is some confusion of terminology. In web2py, a controller is 
> a file in the /controllers folder, and each function in that file is an 
> action reachable via an HTTP request. A view is not executed independently 
> but associated with a particular function in a controller. With this 
> terminology in mind, can you detail your set of controllers and functions 
> and then explain how you want URLs to map to those controllers and 
> functions?
>
> Anthony
>
> On Monday, March 28, 2016 at 9:18:15 AM UTC-4, Carlos Cesar Caballero 
> wrote: 
>>
>> Hi, I am trying to reach a routes behavior for an app but I can´t, so I 
>> need some tips... 
>>
>> I have in my app countries, cities and states (or province), countries 
>> have states and states have cities. Each une of them have its own 
>> controller and view, and I want the next behavior: 
>>
>> www.myapp.com/cuba - run country conntroller and view (for Cuba country) 
>> www.myapp.com/cuba/cienfuegos - run state conntroller and view (for 
>> Cienfuegos state of Cuba country) 
>> www.myapp.com/cuba/cienfuegos/cienfuegos - run city conntroller and view 
>> (for Cienfuegos city, Cienfuegos state of Cuba country) 
>>
>> I will higly appreciate any help with this. 
>>
>> Greetings. 
>>
>> -- 
>> Este mensaje le ha llegado mediante el servicio de correo electronico que 
>> ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
>> Nacional de Salud. La persona que envia este correo asume el compromiso de 
>> usar el servicio a tales fines y cumplir con las regulaciones establecidas 
>>
>> Infomed: http://www.sld.cu/ 
>>
>> -- 
> 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.
>
>
>

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


Re: [web2py] Re: Trying to reach a routes behavior

2016-03-28 Thread Carlos Cesar Caballero Díaz
Hi Antony, I was not clear enough... I have a country controller with a 
default index function, and the same with a state controller and a city 
controller, so right now:


if I call www.myapp.com/country/cuba I get my country page for Cuba (the 
index function of country controller with cuba as parameter)
if I call www.myapp.com/state/cuba/cienfuegos I get my state page for 
Cienfuegos, Cuba state (the index function of state controller with cuba 
and cienfuegos as parameter)
and if I call www.myapp.com/city/cuba/cienfuegos/cienfuegos I get my 
city page for Cienfuegos, Cienfuegos, Cuba city (the index function of 
city controller with cuba, cienfuegos, and cienfuegos as parameter)


I need to find a way to map directly to such pages without specify 
country, state or city controllers depending of the number of params.


Greetings.

El 28/03/16 a las 10:59, Anthony escribió:
I think there is some confusion of terminology. In web2py, a 
controller is a file in the /controllers folder, and each function in 
that file is an action reachable via an HTTP request. A view is not 
executed independently but associated with a particular function in a 
controller. With this terminology in mind, can you detail your set of 
controllers and functions and then explain how you want URLs to map to 
those controllers and functions?


Anthony

On Monday, March 28, 2016 at 9:18:15 AM UTC-4, Carlos Cesar Caballero 
wrote:


Hi, I am trying to reach a routes behavior for an app but I can´t,
so I
need some tips...

I have in my app countries, cities and states (or province),
countries
have states and states have cities. Each une of them have its own
controller and view, and I want the next behavior:

www.myapp.com/cuba  - run country
conntroller and view (for Cuba country)
www.myapp.com/cuba/cienfuegos
 - run state conntroller and
view (for
Cienfuegos state of Cuba country)
www.myapp.com/cuba/cienfuegos/cienfuegos
 - run city
conntroller and view
(for Cienfuegos city, Cienfuegos state of Cuba country)

I will higly appreciate any help with this.

Greetings.

-- 
Este mensaje le ha llegado mediante el servicio de correo

electronico que ofrece Infomed para respaldar el cumplimiento de
las misiones del Sistema Nacional de Salud. La persona que envia
este correo asume el compromiso de usar el servicio a tales fines
y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

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




--
Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

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