Code

* Add support for actions to XMLRPC interface.
[roundup.git] / roundup / cgi / exceptions.py
1 """Exceptions for use in Roundup's web interface.
2 """
4 __docformat__ = 'restructuredtext'
6 from roundup.exceptions import LoginError, Unauthorised
7 import cgi
9 class HTTPException(Exception):
10     pass
12 class Redirect(HTTPException):
13     pass
15 class NotFound(HTTPException):
16     pass
18 class NotModified(HTTPException):
19     pass
21 class FormError(ValueError):
22     """An 'expected' exception occurred during form parsing.
24     That is, something we know can go wrong, and don't want to alarm the user
25     with.
27     We trap this at the user interface level and feed back a nice error to the
28     user.
30     """
31     pass
33 class SendFile(Exception):
34     """Send a file from the database."""
36 class SendStaticFile(Exception):
37     """Send a static file from the instance html directory."""
39 class SeriousError(Exception):
40     """Raised when we can't reasonably display an error message on a
41     templated page.
43     The exception value will be displayed in the error page, HTML
44     escaped.
45     """
46     def __str__(self):
47         return """
48 <html><head><title>Roundup issue tracker: An error has occurred</title>
49  <link rel="stylesheet" type="text/css" href="@@file/style.css">
50 </head>
51 <body class="body" marginwidth="0" marginheight="0">
52  <p class="error-message">%s</p>
53 </body></html>
54 """%cgi.escape(self.args[0])
56 # vim: set filetype=python sts=4 sw=4 et si :