paulb@604 | 1 | #!/usr/bin/env python |
paulb@604 | 2 | |
paulb@604 | 3 | """ |
paulb@604 | 4 | Standard error message output. |
paulb@604 | 5 | |
paulb@604 | 6 | Copyright (C) 2006 Paul Boddie <paul@boddie.org.uk> |
paulb@604 | 7 | |
paulb@604 | 8 | This library is free software; you can redistribute it and/or |
paulb@604 | 9 | modify it under the terms of the GNU Lesser General Public |
paulb@604 | 10 | License as published by the Free Software Foundation; either |
paulb@604 | 11 | version 2.1 of the License, or (at your option) any later version. |
paulb@604 | 12 | |
paulb@604 | 13 | This library is distributed in the hope that it will be useful, |
paulb@604 | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
paulb@604 | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
paulb@604 | 16 | Lesser General Public License for more details. |
paulb@604 | 17 | |
paulb@604 | 18 | You should have received a copy of the GNU Lesser General Public |
paulb@604 | 19 | License along with this library; if not, write to the Free Software |
paulb@604 | 20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
paulb@604 | 21 | """ |
paulb@604 | 22 | |
paulb@604 | 23 | from WebStack.Generic import ContentType |
paulb@604 | 24 | |
paulb@604 | 25 | class ErrorResource: |
paulb@604 | 26 | |
paulb@604 | 27 | "An error resource which should not itself cause error conditions." |
paulb@604 | 28 | |
paulb@604 | 29 | def respond(self, trans): |
paulb@604 | 30 | trans.set_content_type(ContentType("text/html")) |
paulb@604 | 31 | out = trans.get_response_stream() |
paulb@604 | 32 | out.write("""<html> |
paulb@604 | 33 | <head> |
paulb@604 | 34 | <title>Error</title> |
paulb@604 | 35 | </head> |
paulb@604 | 36 | <body> |
paulb@604 | 37 | <h1>Error</h1> |
paulb@604 | 38 | <p>An error has occurred preventing the application from returning a response.</p> |
paulb@604 | 39 | </body> |
paulb@604 | 40 | </html> |
paulb@604 | 41 | """) |
paulb@604 | 42 | |
paulb@604 | 43 | # vim: tabstop=4 expandtab shiftwidth=4 |