The '!' character comes from the following thread : https://groups.google.com/forum/?fromgroups=#!searchin/web2py/routes_in$20massimo$20%22!$24a%22/web2py/WLEtec0asUc/PfT9pAlMv5QJ In this thread, Massimo said : "*You need the "!" or some other id to prevent conflits with admin and other internal URLs*"
But I tried without '!' and it seems to work fine... Finally I updated my routes.py to : # -*- coding: utf-8 -*- routes_in = ( (r'/myapp', r'/myapp/default/index'), (r'/myapp/images', r'/myapp/images/images'), (r'/myapp/contact', r'/myapp/default/contact_form'), (r'/myapp/(?P<url>[\w_.-]+)', r'/myapp/pages/show_page/\g<url>'), ) routes_out = [(x, y) for (y, x) in routes_in[:-1:]] routes_out += [ (r'/myapp/pages/show_page/(?P<url>[\w_.-]+)', r'/myapp/\g<url>'), ] And everything seems to works as expected Thank you very much Jonathan Le vendredi 3 mai 2013 18:12:47 UTC+2, Jonathan Lundell a écrit : > > On 3 May 2013, at 9:02 AM, Loïc <loic....@gmail.com <javascript:>> 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.