On 3 May 2013, at 9:02 AM, Loïc <loic.esp...@gmail.com> wrote:
> After some tries, I have found a solution : 
> 
> In web2py folder :
> routes.py 
> # -*- coding: utf-8 -*-
> routes_app = ((r'/(?P<app>admin)\b.*', r'\g<app>'),
>               (r'(.*)', r'myApp'),
>               (r'/?(.*)', r'myApp'))
> 
> In my app folder : 
> routes.py
> # -*- coding: utf-8 -*-
> routes_in = (
>   ('/myApp/!$a', '/myApp/pages/show_page/$a'),
>   ('/myApp', '/myApp/default/index'),
>   ('/myApp/images', '/myApp/images/images'),
>   ('/myApp/contact', '/myApp/default/contact_form'),
> )
> routes_out = [(x, y) for (y, x) in routes_in]
> 
> 
> Everything works fine excepted one thing :
> an incoming url like http://www.myapp.com/pages/show_page/foo is rewrited in  
> http://www.myapp.com/foo  ==> that's OK
> an incoming url like http://www.myapp.com/pages/show_page/foo-bar is not 
> rewrited
> 
> it seems that hyphens in the last parameter prevents rewriting
> 
> Any idea why?
> 

$a is a shortcut for ?P<a>\w+,, and \w doesn't match hyphens. You'll need to 
spell out your pattern.

What's the ! doing?

-- 

--- 
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/groups/opt_out.


Reply via email to