Correction crash
[auf_roundup.git] / build / lib / roundup / cgi / exceptions.py
... / ...
CommitLineData
1"""Exceptions for use in Roundup's web interface.
2"""
3
4__docformat__ = 'restructuredtext'
5
6from roundup.exceptions import LoginError, Unauthorised
7import cgi
8
9class HTTPException(Exception):
10 pass
11
12class Redirect(HTTPException):
13 pass
14
15class NotFound(HTTPException):
16 pass
17
18class NotModified(HTTPException):
19 pass
20
21class FormError(ValueError):
22 """An 'expected' exception occurred during form parsing.
23
24 That is, something we know can go wrong, and don't want to alarm the user
25 with.
26
27 We trap this at the user interface level and feed back a nice error to the
28 user.
29
30 """
31 pass
32
33class SendFile(Exception):
34 """Send a file from the database."""
35
36class SendStaticFile(Exception):
37 """Send a static file from the instance html directory."""
38
39class SeriousError(Exception):
40 """Raised when we can't reasonably display an error message on a
41 templated page.
42
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])
55
56# vim: set filetype=python sts=4 sw=4 et si :