Hi Mmlado - Welcome, and thanks for the patch. Massimo is on a trip (and I'm sure he'll look at it soon as he can, but may not be for over a week - not sure if he'll have internet where he is - ah! spring break!).
I'll look at your patch later. Looking forward to hearing more from you! Regards, Yarko On Thu, Mar 19, 2009 at 11:56 AM, Mladen Milankovic <[email protected]>wrote: > Hi. > > My name is Mladen Milankovic, and I'm a first time poster. I've been > working > with web2py for a couple of months (reading mailing list from that time), > and > around a year with python. > > I like writing applications in web2py, because it's easy and fast... I came > from php. :) > > Wanted to use web2py through apache. At first I used it through mod_proxy, > but > wanted to go to wsgi. I manage several domain names and needed to access > different application from web2py as if they run through the root, without > the > application/controller/function. I managed to make it work like needed > through > mod_proxy, but rewrite through wsgi was hard for me. routes.py was much > easier, at least for me, but I could only setup one set of rewrite > instructions in it. > > I saw AchipAs post in "web2py and GAE" thread about modifying the routes.py > so > it can be given parameter about host, so different host names have > different > rewrite instructions. Unfortunately this was the last post I saw about this > topic. > > Thought to give it a try and write a patch that will do that. I tested it > directly and through proxy and wsgi. It's backward compatible. Didn't have > any > problems with it. Further testing needed. > > I went with AchipAs solution of third parameter to every rewrite > instruction: > example > routes_in = (('.*:/favicon.ico', '/examples/static/favicon.ico'), > ('.*:/robots.txt', '/examples/static/robots.txt'), > ('.*:/robots.txt', '/myapp/static/robots.txt', 'mydomain.com > '), > ('.*:/', '/myapp/default/index', 'mydomain.com') > ) > Now when /robots.txt is called through mydomain.com it will give the one > from > /myapp/static/, and when called through any other the one from > /examples/static/. Also mydomain.com/ will give /myapp/default/index page. > Same rules apply for routes_out and routes_onerror. Host name can be > written > in regular expression, and instructions with host name will be prioritized. > They will be checked first. > > Modified files: > /gloun/rewrite.py > /gluon/main.py > > Unfortunately, had to modify gluon/main.py, too. It contains > check_error_route > function, as I read in the comment because of IE. Tried it only with > Firefox. > > Found on net how to create svn patch. It created against svn, revision 796. > > regards > mmlado > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

