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 ?
>