web/_exceptions.py
branchtls-sprint
changeset 1802 d628defebc17
parent 320 e2647e72afe7
child 1977 606923dff11b
equal deleted inserted replaced
1801:672acc730ce5 1802:d628defebc17
     1 # pylint: disable-msg=W0401,W0614
     1 # pylint: disable-msg=W0401,W0614
     2 """exceptions used in the core of the CubicWeb web application
     2 """exceptions used in the core of the CubicWeb web application
     3 
     3 
     4 :organization: Logilab
     4 :organization: Logilab
     5 :copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     5 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     6 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     6 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     7 """
     7 """
     8 __docformat__ = "restructuredtext en"
     8 __docformat__ = "restructuredtext en"
     9 
     9 
    10 from cubicweb._exceptions import *
    10 from cubicweb._exceptions import *
    11 
    11 
    12 class PublishException(CubicWebException):
    12 class PublishException(CubicWebException):
    13     """base class for publishing related exception"""
    13     """base class for publishing related exception"""
    14     
    14 
    15 class RequestError(PublishException):
    15 class RequestError(PublishException):
    16     """raised when a request can't be served because of a bad input"""
    16     """raised when a request can't be served because of a bad input"""
    17 
    17 
    18 class NothingToEdit(RequestError):
    18 class NothingToEdit(RequestError):
    19     """raised when an edit request doesn't specify any eid to edit"""
    19     """raised when an edit request doesn't specify any eid to edit"""
    20     
    20 
    21 class NotFound(RequestError):
    21 class NotFound(RequestError):
    22     """raised when a 404 error should be returned"""
    22     """raised when a 404 error should be returned"""
    23 
    23 
    24 class Redirect(PublishException):
    24 class Redirect(PublishException):
    25     """raised to redirect the http request"""
    25     """raised to redirect the http request"""
    32 
    32 
    33 class StatusResponse(Exception):
    33 class StatusResponse(Exception):
    34     def __init__(self, status, content=''):
    34     def __init__(self, status, content=''):
    35         self.status = int(status)
    35         self.status = int(status)
    36         self.content = content
    36         self.content = content
    37     
    37 
    38 class ExplicitLogin(AuthenticationError):
    38 class ExplicitLogin(AuthenticationError):
    39     """raised when a bad connection id is given or when an attempt to establish
    39     """raised when a bad connection id is given or when an attempt to establish
    40     a connection failed"""
    40     a connection failed"""
    41 
    41 
    42 class InvalidSession(CubicWebException):
    42 class InvalidSession(CubicWebException):
    53         self.reason = reason
    53         self.reason = reason
    54 
    54 
    55     def dumps(self):
    55     def dumps(self):
    56         import simplejson
    56         import simplejson
    57         return simplejson.dumps({'reason': self.reason})
    57         return simplejson.dumps({'reason': self.reason})
    58