Sorry I posted too early,

My solution is:

in routes.py in the base folder, where myapp is the actual name of the 
application I'm developing.

routes_app = ((r'/(?P<app>welcome|admin|myapp)\b.*', r'\g<app>'),)

and in myapp's folder, I have another routes.py with the following,

routes_in = ((r'/myapp/users/(?P<id>\d*)', r'/myapp/users/index/\g<id>'),)

routes_out = ((r'/myapp/users/index/(?P<id>\d*)', r'/myapp/users/\g<id>'),')

This is what worked for me. 


Alex


On Friday, May 18, 2012 2:11:28 PM UTC-4, Alexander McLin wrote:
>
> Sorry if I wasn't clear, I actually meant URLs of the following form, 
> myapp/controller/args to be mapped to myapp/controller/index/args. The 
> second point of confusion takes a different tack on web2py routing than the 
> first point.
>
> I'll try to experiment with your solution though.
>
> For future notes, I actually got the pattern-matching solution working, I 
> realized that what I was missing was that I had to include my application's 
> name in the routes_app for the custom routes to be enabled.
>
> In any event, my solution is
>
> On Friday, May 18, 2012 9:17:30 AM UTC-4, Wikus van de Merwe wrote:
>>
>> OK, so you want /myapp/args to be mapped to 
>> /myapp/default_controller/default_function/args. By default args would be 
>> interpreted as a function name and will be mapped to 
>> /myapp/default_controller/args. To change that you need to define a list of 
>> functions for the default controller. Then if args is not in that list it 
>> would be mapped to /myapp/default_controller/default_function/args.
>>
>> routers = dict( 
>>     myapp = dict(
>>         default_controller = "default",
>>         default_function = "index",
>>         functions = ["fun1", "fun2", "fun3"]
>>     )
>> )
>>
>>

Reply via email to