Routes on Error

You can also use "" to redirect the visitor to special actions in case there is an error on server. You can specify this mapping globally, for each app, for each error code, for each app and error code. Here is an example:

1 routes_onerror = [

For each tuple the first string is matched against" [appname]/[error code]". If a match is found the user is redirected to the URL in the second string of the matching tuple. In case a ticket was issued, the ticket is passed to the new URL as a GET variable called ticket.

Unmatched errors display a default error page. This default error page can also be customized here:

1 error_message = '<html><body><h1>Invalid request</h1></body></html>'

2 error_message_ticket = '<html><body><h1>Internal error</h1>Ticket issued: <a href="/admin/default/ticket/%(ticket)s" target="_blank ">% (ticket)s</a></body></html>'

The first variable contains the error message when an invalid application is requested. The second variable contains the error message when a ticket is issued.

Was this article helpful?

0 0

Post a comment