The patch is now in trunk -- please test. If you can, it would be helpful 
if you could try it out with different types of rewrite rules. Also, try it 
using the parameter-based rewrite system, as well as with no rewrite rules 
at all (want to make sure we didn't break anything).

FYI, an easier way to strip the application name from your URLs is to use 
the parameter-based rewrite system -- put this in routes.py instead of your 
routes_in, routes_out:

routers = dict(
    BASE = dict(
        default_application = 'appname',
    ),
)

See http://web2py.com/book/default/chapter/04#Parameter-Based-System.

Another option is simply to name your app 'init'.

Anthony

On Friday, November 18, 2011 2:20:24 PM UTC-5, Niphlod wrote:
>
> feel free to suggest anything you want, I'm happy to test it 
> heavily :D 
>
> On 18 Nov, 18:50, Anthony <abas...@gmail.com> wrote: 
> > Looks like this is a bug. I may have a fix... 
> > 
> > Anthony 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Friday, November 18, 2011 9:31:00 AM UTC-5, Niphlod wrote: 
> > 
> > > Hi Anthony, /errors/index function is a simple: 
> > 
> > > def index(): 
> > >     #response.status = request.vars.code 
> > >     return dict(vars=request.vars) 
> > 
> > > Notice the response.status line commented, it's the one triggering the 
> > > loop. 
> > > The template is very simple, in fact I simulated all kinds of error 
> > > and it gets rendered correctly. It's only setting the status on the 
> > > controller (the commented line in the index() function) that triggers 
> > > the infinite loop. 
> > 
> > > routes_onerror is exactly as reported, with the leading '/'. 
> > 
> > > BTW, I'm using 1.99.2 
> > 
> > > On 18 Nov, 08:56, Anthony <aba...@gmail.com> wrote: 
> > > > What does your /errors/index function look like? Also, is that your 
> > > exact 
> > > > routes_onerror? I ask because there is a bug (now fixed in trunk) 
> that 
> > > > leads to a loop if your routes_onerror path is missing the leading 
> '/' 
> > > > (i.e., 'errors/index' would create a loop, whereas '/errors/index' 
> would 
> > > > not). 
> > 
> > > > Anthony 
> > 
> > > > On Friday, November 18, 2011 8:20:38 AM UTC-5, Niphlod wrote: 
> > 
> > > > > Hi @all, 
> > > > >     I have a small problem with routes.py and the routes_onerror 
> > > > > parameter. 
> > 
> > > > > Basically I have one and only application "mounted" in the 
> webserver 
> > > > > and I'd like to strip the "application" part from all urls. 
> > 
> > > > > Leave alone the redirections for static folder, favicon, robots, 
> > > > > sitemap etc, this is done wonderfully setting: 
> > 
> > > > > routes_in = ( 
> > > > >   ('/(?P<any>.*)', '/appname/\g<any>') 
> > > > > ) 
> > 
> > > > > routes_out = ( 
> > > > >   ('/appname/(?P<any>.*)', '/\g<any>') 
> > > > > ) 
> > 
> > > > > Now, let's say I want to display a simple page instead of the 
> default 
> > > > > error page. 
> > 
> > > > > routes_onerror = [ 
> > > > >   ('*/*', '/errors/index') 
> > > > > ] 
> > 
> > > > > Working perfectly fine this one also. 
> > > > > I created a simple "errors" controller, with an "index()" function 
> in 
> > > > > it, and created a view /errors/index.html. 
> > 
> > > > > Request.vars is populated accordingly to the errors, so I can 
> change 
> > > > > the content of the page dinamically, there's only a small problem: 
> if 
> > > > > I try to change the response.status code (if there's a 404 Not 
> Found 
> > > > > it's not "polite" to return a 200 OK status) rewrite kicks in and 
> > > > > loops forever. 
> > 
> > > > > Any hints on how to achieve the same result with different 
> parameters, 
> > > > > if this is not a bug ?

Reply via email to