On Aug 8, 2010, at 5:33 PM, Thadeus Burgess wrote:

> The routes.example.py contains some unit tests. I have found this to
> be the most effective way of testing my routes to make sure they do
> what I want.

Also, I sent a note (yesterday?) to this list on how to use compile_re() in 
doctest to see what the regex turned into (web2py munges it a little). That can 
be helpful.

filter_url in the doctest has to convert the "incoming" URL to a set of env 
variables, in imitation of the web server. So the action of the server isn't in 
the loop, which could make a difference in some circumstances, I suppose. 
That's why I'd like to see logging.

rewrite.py already does some logging. I'll take a look at doing something 
simpleminded. Maybe a logging-enable variable in routes.py....

I'm hacking in there anyway at the moment.

> 
> --
> Thadeus
> 
> 
> 
> 
> 
> On Sun, Aug 8, 2010 at 7:30 PM, Jonathan Lundell <[email protected]> wrote:
>> On Aug 8, 2010, at 5:10 PM, Andrew Thompson wrote:
>> 
>>> I can not wrap my head around routes_in. I'm attempting to host 3 sites via 
>>> lighttpd and fcgihandler.py (is this the best way?)
>>> 
>>> I ripped this mostly from a mdpierro post, and tweaked it for my domain, 
>>> but I'm just not making progress:
>>> 
>>>  ('(.*):https?://(.*)mysite\.com:(.*) /favicon.ico', 
>>> '/mysite/static/favicon.ico'),
>>> 
>>> http://mysite.com/mysite/static/favicon.ico <-- this link works.
>>> http://myste.com/favicon.ico <-- Invalid request
>> 
>> You meant 'mysite', right?
>> 
>>> 
>>> I've been playing with the builtin doctest, and this passes:
>>> 
>>>>>> filter_url('http://mysite.com/favicon.ico')
>>>  'http://mysite.com/mysite/static/favicon.ico'
>>> 
>>> Any ideas what I'm doing wrong?
>> 
>> You're restarting web2py when you change routes.py?
>> 
>> I think it'd be useful to be able to turn on logging of URL rewriting. It'd 
>> be pretty verbose, I suppose, but useful for this kind of problem.
>> 
>>> 
>>> I have two more lines commented out that I also want to put in:
>>> 
>>>  ('(.*):https?://(.*)mysite\.com:(.*) /$anything', '/mysite/$anything'),
>>>  ('(.*):https?://(.*)mysite\.com:(.*) /images/$anything', 
>>> '/mysite/static/images/$anything'),
>>> 
>>> I'm not sure, is $anything is compatible with all those .*'es?
>> 
>> I think so. No need to parenthesize them, since there's no capture going on. 
>> I might use .*? instead. But .* should work in this case.
>> 
>>> 
>>> I do need the / to /mysite's to keep the sites separated from each other, 
>>> don't I?
>> 
>> I don't follow the question.
>> 
>>> 
>>> Any help appreciated.
>>> 
>>> --
>>> Andrew Thompson
>>> http://aktzero.com/
>>> 
>> 
>> 
>> 


Reply via email to