Great. Thanks for checking.
On Sunday, November 20, 2011 12:01:41 PM UTC-5, Niphlod wrote: > > yes, as far as I can tell the patch solved the infinite loop problem. > All other things are working correctly: it did not brake anything as > far as my tests gone. > > On 20 Nov, 17:14, Anthony <[email protected]> wrote: > > OK, so specifically regarding routes_onerror, has the recent patch > > eliminated the infinite loop problem (and not broken anything else), as > far > > as you can tell? > > > > And yes, the pattern-based and parameter-based systems cannot be mixed -- > > you must use one or the other. routes_onerror, however, works with either > > system. > > > > Note, in the parameter-based system, you can do: > > > > routers = dict( > > BASE = dict( > > default_application = 'appname', > > root_static = ['favicon.ico', 'robots.txt', 'sitemap.xml'] > > ), > > ) > > > > to set static files that should be accessible from the root URL. > > > > Anthony > > > > > > > > > > > > > > > > On Sunday, November 20, 2011 8:53:42 AM UTC-5, Niphlod wrote: > > > > > so, here's a few tests on the functionality at the current state > > > (patch applied). Maybe we can sum up a little "recipe" to explain > > > better > > > the "interaction" between parameter based and pattern based > > > rewrite.... > > > > > These settings for production sites are a real deal, so, here we > > > are... > > > The test is a basic app, with an errors/index function expressed as: > > > > > def index(): > > > response.status = request.vars.code > > > return dict(vars=request.vars) > > > > > The test is "passed" when: > > > a) the appname is stripped from the url > > > b) the error handler doesn't loop forever > > > c) a request made tohttp://host.domain/robots.txtreturns the > > > contents of appname/static/robots.txt > > > d) a request made tohttp://host.domain/favicon.icoreturns the > > > contents of appname/static/favicon.ico > > > e) a request made tohttp://host.domain/sitemap.xmlreturns the > > > contents of appname/static/sitemap.xml > > > > > TEST 1: > > > ---routes.py--- > > > default_application = 'appname' > > > routes_onerror = [ > > > ('*/*', '/appname/errors/index') > > > ] > > > > > results : a) not working (that's expected), b) working, c), d), e) not > > > working (expected behaviour) > > > > > TEST 2: > > > ---routes.py--- > > > default_application = 'appname' > > > routers = dict( > > > BASE = dict( > > > default_application = 'appname', > > > ), > > > ) > > > > > routes_onerror = [ > > > ('*/*', '/errors/index') > > > ] > > > > > results: a) working, b) working, c) working, d) working, e) not > > > working > > > > > ---routes.py--- > > > default_application = 'appname' > > > routes_in = ( > > > ('/robots.txt', '/static/robots.txt'), > > > ('/sitemap.xml', '/static/sitemap.xml'), > > > ('/favicon.ico', '/static/favicon.ico'), > > > ) > > > > > routes_out = ( > > > ('/static/robots.txt', '/robots.txt'), > > > ('/static/sitemap.xml', '/sitemap.xml'), > > > ('/static/favicon.ico', '/favicon.ico'), > > > ) > > > > > routers = dict( > > > BASE = dict( > > > default_application = 'appname', > > > ), > > > ) > > > > > routes_onerror = [ > > > ('*/*', '/errors/index') > > > ] > > > > > results: a) working, b) working, c) working, d) working, e) not > > > working > > > > > TEST 3: > > > ---routes.py--- > > > default_application = 'appname' > > > routes_in = ( > > > ('/(?P<any>.*)', '/appname/\g<any>'), > > > ('/favicon.ico', '/appname/static/favicon.ico'), > > > ('/sitemap.xml', '/appname/static/sitemap.xml'), > > > ('/robots.txt', '/appname/static/robots.txt') > > > ) > > > > > routes_out = ( > > > ('/appname/(?P<any>.*)', '/\g<any>'), > > > ('/appname/static/favicon.ico', '/favicon.ico' ), > > > ('/appname/static/robots.txt', '/robots.txt'), > > > ('/appname/static/sitemap.xml', '/sitemap.xml') > > > ) > > > > > routes_onerror = [ > > > ('*/*', '/errors/index') > > > ] > > > > > results: a) working, b) working, c) working, d) working, e) not > > > working > > > > > TEST 4: > > > default_application = 'appname' > > > routes_in = ( > > > ('/favicon.ico', '/appname/static/favicon.ico'), > > > ('/robots.txt', '/appname/static/robots.txt'), > > > ('/sitemap.xml', '/appname/static/sitemap.xml'), > > > ('/(?P<any>.*)', '/appname/\g<any>') > > > ) > > > > > routes_out = ( > > > ('/appname/static/favicon.ico', '/favicon.ico' ), > > > ('/appname/static/robots.txt', '/robots.txt'), > > > ('/appname/static/sitemap.xml', '/sitemap.xml'), > > > ('/appname/(?P<any>.*)', '/\g<any>') > > > ) > > > results: a) working, b) working, c) working, d) working, e) working > > > > > So, to sum up, something I think I have learned from the experience: > > > - pattern-based and parameter-based aren't meant to use together. With > > > pattern-based system "root files" as robots.txt and favicon.ico are > > > handled internally but not sitemap.xml (or anything else) > > > - routes_onerror seems to work independantly of the "rewrite method" > > > - in pattern-based system the order matters. This is an expected > > > behaviour but nonetheless worth to remember. As an example, take TEST > > > 3 and TEST 4... sitemap.xml gets "taken" by the ('/(?P<any>.*)', '/ > > > appname/\g<any>') tuple in TEST 3 before the "exact match". > > > - parameter-based is really helpful to map domains to apps or if you > > > have multiple apps but only one "preferred", or with language-based > > > redirections. With parameter-based system you can access other apps by > > > "normal" non-rewritten urls. With pattern-based if you want to have a > > > "default" application you have to map any additional application > > > specifically. >

