comparison roundup/cgi/exceptions.py @ 6039:0dc1e0222353

flake8 whitespace changes, suppress unused import warning
author John Rouillard <rouilj@ieee.org>
date Tue, 07 Jan 2020 21:21:20 -0500
parents 08b241c9fea4
children c177e7128dc9
comparison
equal deleted inserted replaced
6038:fb1367285bd7 6039:0dc1e0222353
1 """Exceptions for use in Roundup's web interface. 1 """Exceptions for use in Roundup's web interface.
2 """ 2 """
3 3
4 __docformat__ = 'restructuredtext' 4 __docformat__ = 'restructuredtext'
5 5
6 from roundup.exceptions import LoginError, Unauthorised 6 from roundup.exceptions import LoginError, Unauthorised # noqa: F401
7 7
8 from roundup.anypy.html import html_escape 8 from roundup.anypy.html import html_escape
9
9 10
10 class HTTPException(BaseException): 11 class HTTPException(BaseException):
11 pass 12 pass
12 13
14
13 class Redirect(HTTPException): 15 class Redirect(HTTPException):
14 pass 16 pass
17
15 18
16 class NotFound(HTTPException): 19 class NotFound(HTTPException):
17 pass 20 pass
18 21
22
19 class NotModified(HTTPException): 23 class NotModified(HTTPException):
20 pass 24 pass
21 25
26
22 class PreconditionFailed(HTTPException): 27 class PreconditionFailed(HTTPException):
23 pass 28 pass
29
24 30
25 class DetectorError(BaseException): 31 class DetectorError(BaseException):
26 """Raised when a detector throws an exception. 32 """Raised when a detector throws an exception.
27 Contains details of the exception.""" 33 Contains details of the exception."""
28 def __init__(self, subject, html, txt): 34 def __init__(self, subject, html, txt):
29 self.subject = subject 35 self.subject = subject
30 self.html = html 36 self.html = html
31 self.txt = txt 37 self.txt = txt
32 BaseException.__init__ (self, subject + ' ' + txt) 38 BaseException.__init__(self, subject + ' ' + txt)
39
33 40
34 class FormError(ValueError): 41 class FormError(ValueError):
35 """An 'expected' exception occurred during form parsing. 42 """An 'expected' exception occurred during form parsing.
36 43
37 That is, something we know can go wrong, and don't want to alarm the user 44 That is, something we know can go wrong, and don't want to alarm the user
41 user. 48 user.
42 49
43 """ 50 """
44 pass 51 pass
45 52
53
46 class SendFile(BaseException): 54 class SendFile(BaseException):
47 """Send a file from the database.""" 55 """Send a file from the database."""
48 56
57
49 class SendStaticFile(BaseException): 58 class SendStaticFile(BaseException):
50 """Send a static file from the instance html directory.""" 59 """Send a static file from the instance html directory."""
60
51 61
52 class SeriousError(BaseException): 62 class SeriousError(BaseException):
53 """Raised when we can't reasonably display an error message on a 63 """Raised when we can't reasonably display an error message on a
54 templated page. 64 templated page.
55 65
62 <link rel="stylesheet" type="text/css" href="@@file/style.css"> 72 <link rel="stylesheet" type="text/css" href="@@file/style.css">
63 </head> 73 </head>
64 <body class="body" marginwidth="0" marginheight="0"> 74 <body class="body" marginwidth="0" marginheight="0">
65 <p class="error-message">%s</p> 75 <p class="error-message">%s</p>
66 </body></html> 76 </body></html>
67 """%html_escape(self.args[0]) 77 """ % html_escape(self.args[0])
68 78
69 # vim: set filetype=python sts=4 sw=4 et si : 79 # vim: set filetype=python sts=4 sw=4 et si :

Roundup Issue Tracker: http://roundup-tracker.org/