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

Reply via email to