Hi.

Thank you very much. This is more powerful and more useful then what I did. I 
see I have a lot to learn.

regards
mmlado

On Thursday 16 April 2009 19:57:47 mdipierro wrote:
> A request comes in and you want to redirect it to a controller action
> filtering by
> - IP of client (for example 127.0.0.1)
> - requested protocol (for example http or http "(http|https)""
> - requested hostname (for example www.web2py.com)
> - type of request (for example get or post "(get|post)")
> - requested URL (for example "/test")
>
> You would capture it with
>
>   "^[client]:[protocol]://[hostname]:[method] [url]$"
>
> in the example
>
>   "^127.0.0.1:(http|https)://www.web2py.com:(get|post) /test"
>
> Now you can map this into for example "/welcome/default/index" with
> routes.py
>
>   routes_in=(("^127.0.0.1:(http|https)://www.web2py.com:(get|post) /
> test", "/welcome/default/index"),)
>
> I can see writing an entire book in this only.
> Can you figure out what this does?
>
>   routes_in=(("^127.0.0.1:$a://www.web2py.com:(get|post) /test/$b", "/
> welcome/default/$b?method=$a"),)
>
> and this?
>
>   routes_in=(("^127.0.0.1:$a://www.web2py.com:(get|post) /test/(?
> P<b>.*)", "/welcome/default/$b?method=$a"),)
>
> I know it is ugly but 1) it works; 2) it very powerful when compared
> with routes on rails and urls in Django; 3) is is backward compatible.
>
> Does not anybody remember that I never wanted to add this to web2py?
> Now you know why.
>
> Massimo
>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to