Hi.

I think it's a bug in rewrite.py modul.
If you open the file, it's in gluon directory, on line 54 you can see the 
following:

if k.find(':/') > 0:
    i = k.find(':/')
    k = r'%s:https?://[^:/]+:[a-z]+ %s' % (k[:i], k[i+1:])

Think this should insert regex part for the domain when written in format 
ip:/route. But this will act on :/ in the domain name too...

From:
 *:http://mydomain.com POST / 
becomes something like this:
 *:http:https?://[^:/]+:[a-z]+ //mydomain.com POST /
Which won't match almost anything.
I changed the if statement to:

if k.find(':/') > 0 and k.find('://') == -1:

To not count the :// from the domain name. It's not perfect and in this case 
you'll have to compensate for the ip part of the regex in routes py always.
Autocomplete for regexes to make the whole regex statement from routes.py will 
need some rewriting. I would like to rework this part, but I'll have free time 
for it only on Sunday. Until then, please use this little workaround or if you 
want write a patch for it.

regards
mmlado

On Wednesday 23 September 2009 19:30:08 Jon Romero wrote:
> any ideas? anyone?
> 
> On Sep 22, 12:48 pm, Jon Romero <darks...@gmail.com> wrote:
> > Thanks.
> > I was looking the examples from the old book (thinking that there
> > won't be any major changes) but I was wrong.
> > This is in the old book:
> >
> > routes_in=(
> > ('140.192.\d+.\d+:.*','/welcome/default/index'),
> >   )
> >
> > I thought that doing that:
> > routes_in=(
> > ('http://mydomain.com:.*','/myapp/default/index'),
> >   )
> >
> > would work (I also tried escaping the domain name but that didn't work
> > either).
> >
> > Then I tried with the way it is described in the new book and didn't
> > work again (I am pretty sure I am doing something wrong).
> > routes_in=(
> > ('*:http://mydomain.comPOST  / ', '/myapp/default/index'),
> >   )
> >
> > Why the old one (which I find more appropriate for my purposes) didn't
> > work? And how can I make it work?
> >
> > Thanks
> >
> > On Sep 22, 12:05 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> > > > PS: Does routes_in accepts domain names? I tried a little hack but
> > > > didn't work
> > >
> > > yes.
> > > you can find an example on top of page 120. Works as long as as web2py
> > > finds the requested host name in the http header.
> 
> > 

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

Reply via email to