On Aug 14, 2006, at 2:42 PM, Mathias GUG wrote:
>
> Hi,
>
> On 8/14/06, Matthew Burgess <[EMAIL PROTECTED]> wrote:
>> Thanks for those, I was also having problems with the rewrite URLS on
>> the wiki page. The above sorted it nicely!
>>
>> Regards,
>>
>
> Also, I had to modify the error mapper in middleware.py, otherwise
> flup was raising loop errors when an HTTP error was raised. It seems
> that the "Fixing Broken Routes" code doesn't apply to errors.
>
> So I've defined my own error mapper in config/middleware.py (based on
> the original error_mapper function from pylons - it just removes
> '/dispatch.fcgi' from the url) :
>
> def my_error_mapper(code, message, environ, global_conf=None, **kw):
> if global_conf is None:
> global_conf = {}
> codes = [401, 403, 404]
> if not asbool(global_conf.get('debug')):
> codes.append(500)
> if code in codes:
> url = '%s/error/document/?%s'%(get_prefix(environ),
> urlencode({'message'
> :message, 'code':code}))
> if url.startswith('/dispatch.fcgi'):
> url = url[14:]
> return url
>
> And replace the ErrorDocuments line in make_app :
>
> app = ErrorDocuments(app, global_conf, mapper=my_error_mapper,
> **app_conf)
>
>
> After that, error documents are working.
I experienced this myself earlier today:
http://pylonshq.com/project/pylonshq/ticket/90
You can remove/replace get_prefix(environ) with '', instead of the
string replace for a cleaner fix.
We'll have this fixed for 0.9.2, it'll either involve what I just
described, or changing the paste RecursiveMiddleware to accept the
prefix (SCRIPT_NAME).
--
Philip Jenvey
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss
-~----------~----~----~----~------~----~------~--~---