Correct me if i'm wrong, but port numbers are usually nubers so this 
regexp cannot match i think as you have [a-z]+ after : in url. Isn't 
this your trouble?

routes_in = ('^.*?:https?://localhost:[a-z]+/$','/my_app/default/index'), )

Michal

Mladen Milankovic wrote:
> Hi.
> 
> I'm testing things out and I think got a bug.
> 
> I'm trying to get root on localhost to show /my_app/default/index page and 
> not 
> the example, so I wrote:
> 
> routes_in = (('^.*?:https?://localhost:[a-z]+ /$', '/my_app/default/index'), )
> 
> It didn't work, and I throw in some logging. I watched what will be the key 
> before it's converted to regex. It gave:
> ^.*?:https?:https?://[^:/]+:[a-z]+ //localhost:[a-z]+ /$
> 
> Problem is in             
> line 45, in rewrite.py
> 
> if k.find(':/') > 0:
> 
> This line is determining if the definition is in the old format: 
> '.*:/favicon.ico'.
> Problem is that in the new definition :/ can be found again, but it has a 
> different meaning.
> 
> It can be done in many different ways. I used this one:
> 
> if k.find(':/') > 0 and not k.find('://'):
> 
> This way it will match only the old definition and skip the new one.
> 
> 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