Premiere version : mise en route du suivi.
[auf_roundup.git] / roundup / cgi / exceptions.py
1 """Exceptions for use in Roundup's web interface.
2 """
3
4 __docformat__ = 'restructuredtext'
5
6 from roundup.exceptions import LoginError, Unauthorised
7 import cgi
8
9 class HTTPException(Exception):
10 pass
11
12 class Redirect(HTTPException):
13 pass
14
15 class NotFound(HTTPException):
16 pass
17
18 class NotModified(HTTPException):
19 pass
20
21 class 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
33 class SendFile(Exception):
34 """Send a file from the database."""
35
36 class SendStaticFile(Exception):
37 """Send a static file from the instance html directory."""
38
39 class 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 :