1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/WebStack/Adapters/Helpers/Error.py Wed Jan 10 22:27:27 2007 +0000
1.3 @@ -0,0 +1,43 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +"""
1.7 +Standard error message output.
1.8 +
1.9 +Copyright (C) 2006 Paul Boddie <paul@boddie.org.uk>
1.10 +
1.11 +This library is free software; you can redistribute it and/or
1.12 +modify it under the terms of the GNU Lesser General Public
1.13 +License as published by the Free Software Foundation; either
1.14 +version 2.1 of the License, or (at your option) any later version.
1.15 +
1.16 +This library is distributed in the hope that it will be useful,
1.17 +but WITHOUT ANY WARRANTY; without even the implied warranty of
1.18 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1.19 +Lesser General Public License for more details.
1.20 +
1.21 +You should have received a copy of the GNU Lesser General Public
1.22 +License along with this library; if not, write to the Free Software
1.23 +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
1.24 +"""
1.25 +
1.26 +from WebStack.Generic import ContentType
1.27 +
1.28 +class ErrorResource:
1.29 +
1.30 + "An error resource which should not itself cause error conditions."
1.31 +
1.32 + def respond(self, trans):
1.33 + trans.set_content_type(ContentType("text/html"))
1.34 + out = trans.get_response_stream()
1.35 + out.write("""<html>
1.36 +<head>
1.37 + <title>Error</title>
1.38 +</head>
1.39 +<body>
1.40 + <h1>Error</h1>
1.41 + <p>An error has occurred preventing the application from returning a response.</p>
1.42 +</body>
1.43 +</html>
1.44 +""")
1.45 +
1.46 +# vim: tabstop=4 expandtab shiftwidth=4