~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/errors.py

  • Committer: William Grant
  • Date: 2009-12-08 03:50:24 UTC
  • mfrom: (1294.2.143 ui-the-third)
  • Revision ID: grantw@unimelb.edu.au-20091208035024-wjx8zp54gth15ph8
Merge ui-the-third. This is another UI revamp.

The header is now thin! Thin! The yellow bar is gone. The tabs are gone.
Breadcrumbs are here. Routes is replaced (with an object publishing
mechanism). Views are less repetitive. etc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
17
 
18
 
# Author: Will Grant
19
 
 
20
18
class HTTPError(Exception):
21
19
    '''A base class for all HTTP errors.'''
 
20
    message = None
 
21
 
 
22
    def __init__(self, message=None):
 
23
        # Only override the builtin one if it's actually specified.
 
24
        if message:
 
25
            self.message = message
22
26
 
23
27
class BadRequest(HTTPError):
24
28
    codename = 'Bad Request'
 
29
    message = 'Your browser sent a request that IVLE did not understand.'
25
30
    code = 400
26
31
 
27
32
class Unauthorized(HTTPError):
28
33
    codename = 'Unauthorized'
 
34
    message = 'You are not allowed to view this part of IVLE.'
29
35
    code = 401
30
36
 
31
37
class Forbidden(HTTPError):
32
38
    codename = 'Forbidden'
 
39
    message = 'You are not allowed to view this part of IVLE.'
33
40
    code = 403
34
41
 
35
42
class NotFound(HTTPError):
36
43
    codename = 'Not Found'
 
44
    message = 'The requested path does not exist.'
37
45
    code = 404
38
46
 
39
47
class MethodNotAllowed(HTTPError):
42
50
        super(HTTPError, self).__init__(*args, **kwargs)
43
51
 
44
52
    codename = 'Method Not Allowed'
 
53
    message = '''Your browser sent a request to IVLE using the wrong method.
 
54
This is probably a bug in IVLE; please report it to the administrators.'''
45
55
    code = 405