web/_exceptions.py
changeset 5940 0e3ae19b181a
parent 5426 0d4853a6e5ee
child 6491 ee9a10b6620e
equal deleted inserted replaced
5939:a33402c1aa79 5940:0e3ae19b181a
    14 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
    14 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
    15 # details.
    15 # details.
    16 #
    16 #
    17 # You should have received a copy of the GNU Lesser General Public License along
    17 # You should have received a copy of the GNU Lesser General Public License along
    18 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    19 """exceptions used in the core of the CubicWeb web application
    19 """exceptions used in the core of the CubicWeb web application"""
    20 
    20 
    21 """
       
    22 __docformat__ = "restructuredtext en"
    21 __docformat__ = "restructuredtext en"
    23 
    22 
    24 from cubicweb._exceptions import *
    23 from cubicweb._exceptions import *
       
    24 from cubicweb.utils import json_dumps
    25 
    25 
    26 class PublishException(CubicWebException):
    26 class PublishException(CubicWebException):
    27     """base class for publishing related exception"""
    27     """base class for publishing related exception"""
    28 
    28 
    29 class RequestError(PublishException):
    29 class RequestError(PublishException):
    64     def __init__(self, reason=''):
    64     def __init__(self, reason=''):
    65         super(RequestError, self).__init__()
    65         super(RequestError, self).__init__()
    66         self.reason = reason
    66         self.reason = reason
    67 
    67 
    68     def dumps(self):
    68     def dumps(self):
    69         from cubicweb.web import json
    69         return json_dumps({'reason': self.reason})
    70         return json.dumps({'reason': self.reason})
       
    71 
    70 
    72 class LogOut(PublishException):
    71 class LogOut(PublishException):
    73     """raised to ask for deauthentication of a logged in user"""
    72     """raised to ask for deauthentication of a logged in user"""
    74     def __init__(self, url):
    73     def __init__(self, url):
    75         super(LogOut, self).__init__()
    74         super(LogOut, self).__init__()