1. I found out that the url parameters are automatically preserved if I do 
not redirect the request. e.g.
routes_in = (
('/$a/$c/list', '/$a/$c/view'), 
)

and a url '/myapp/client/list?name=alex' gets mapped to 
'/myapp/client/view?name=alex'

but if I want to redirect the request
routes_in = (
('/$a/$c/list', '303->/$a/$c/view'), 
) 

the same url gets redirected to  '/myapp/client/view'. is this a bug? 
actually I was surprised that this works in the first example. I don't know 
what is the expected behavior but I think it should be the same result - 
independent if the request is redirected or not.

2. I'm setting the default application with this mapping
('/$c/$f', '/myapp/$c/$f')
not exactly the same as the default_application setting but close (with 
default_application it is also possible to use urls like 
'/myapp/client/edit' but now I can't include the application name anymore)

my full setting now looks like this:
routes_in = (
  ('/$c/list', '/myapp/$c/view'),
  ('/(?P<any>.*)', '/myapp/\g<any>'),
)

routes_out = (
  ('/myapp/(?P<any>.*)', '/\g<any>'),
)

Are there no experts for this topic? anyway, thanks for reading,
Alex

Am Montag, 11. November 2013 14:52:33 UTC+1 schrieb Alex:
>
> first I had trouble with the simple routing of a specific controller, e.g.
> routes_in = (
>   ('/myapp/client/list', '/myapp/client/view'),
> )
>
> it took sometime until I found out why this didn't work at all. I'm also 
> using the Parameter-based url rewrite system (routers = ...), but this 
> cannot be mixed with the Pattern-based system. It is mentioned in the book 
> but I just overlooked it. Wouldn't it be better if web2py would at least 
> show a warning message in case routers and routes_in are defined? (instead 
> of silently ignoring the defined routes_in)
>
> so now I managed to redirect all my list controllers:
> routes_in = (
> ('/$a/$c/list', '303->/$a/$c/view'), 
> )
>
> I've got 2 issues left:
> 1. how can I preserve url parameters? e.g. /myapp/client/list?name=alex 
> should be redirected to /myapp/client/view?name=alex
> currently the url parameters are lost.
> 2. since I can't use the pattern based system anymore, how can I define a 
> default application?
> previously:
> routers = dict(
>  BASE = dict(
>  default_application = 'myapp',
>  ),
> )
>
> thanks for you help,
> Alex
>
> Am Samstag, 2. November 2013 13:15:37 UTC+1 schrieb Alex:
>>
>> since I found out that naming my controllers 'list' (to display all 
>> existing rows of a specific table) is not a good idea (because it 
>> overwrites the internal list type), I'd now like to rename all 'list' 
>> controllers to 'view'.
>> To make the transitions for the users as smooth as possible all urls to a 
>> 'list' controller should be redirected to 'view'.
>>
>> e.g.
>> /myapp/client/list -> /myapp/client/view
>> /myapp/employee/list?status=active -> /myapp/employee/view?status=active
>>
>> I guess I need a routes_in in my routes.py but I'm not sure about the 
>> exact entry. For a specific url it should be easy:
>> routes_in = (
>>     (BASE + '/myapp/client/list', '/myapp/client/view'),
>> )
>>
>> I'm not so sure about the regular expression to define it for all urls. 
>> To redirect I need to write '303->' at the beginning, is that correct?
>>
>> Alex
>>
>>

-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to