Code

0b3fe932bc7e2c094271da79dd077130b1b27ce3
[roundup.git] / roundup / cgi / exceptions.py
1 class HTTPException(Exception):
2     pass
4 class Unauthorised(HTTPException):
5     pass
7 class Redirect(HTTPException):
8     pass
10 class NotFound(HTTPException):
11     pass
13 class NotModified(HTTPException):
14     pass
16 class FormError(ValueError):
17     """An 'expected' exception occurred during form parsing.
19     That is, something we know can go wrong, and don't want to alarm the user
20     with.
22     We trap this at the user interface level and feed back a nice error to the
23     user.
25     """
26     pass
28 class SendFile(Exception):
29     """Send a file from the database."""
31 class SendStaticFile(Exception):
32     """Send a static file from the instance html directory."""
34 class SeriousError(Exception):
35     """Raised when we can't reasonably display an error message on a
36     templated page.
38     The exception value will be displayed in the error page, HTML
39     escaped.
40     """
41     def __str__(self):
42         return '''
43 <html><head><title>Roundup issue tracker: An error has occurred</title>
44  <meta http-equiv="Content-Type" content="text/html; charset=utf-8;">
45  <link rel="stylesheet" type="text/css" href="_file/style.css">
46 </head>
47 <body class="body" marginwidth="0" marginheight="0">
48  <p class="error-message">%s</p>
49 </body></html>
50 '''%cgi.escape(self.args[0])