web/_exceptions.py
changeset 5408 120db445c179
parent 5385 b6e250dd7a7d
parent 5389 809d3b5b3d31
child 5423 e15abfdcce38
equal deleted inserted replaced
5398:b9e1abe1bdfe 5408:120db445c179
    51     def __init__(self, reason=''):
    51     def __init__(self, reason=''):
    52         super(RequestError, self).__init__()
    52         super(RequestError, self).__init__()
    53         self.reason = reason
    53         self.reason = reason
    54 
    54 
    55     def dumps(self):
    55     def dumps(self):
    56         try:
    56         from cubicweb.web import json
    57             from json import dumps
    57         return json.dumps({'reason': self.reason})
    58         except ImportError:
       
    59             from simplejson import dumps
       
    60         return dumps({'reason': self.reason})
       
    61 
    58 
    62 class LogOut(PublishException):
    59 class LogOut(PublishException):
    63     """raised to ask for deauthentication of a logged in user"""
    60     """raised to ask for deauthentication of a logged in user"""
    64     def __init__(self, url):
    61     def __init__(self, url):
    65         super(LogOut, self).__init__()
    62         super(LogOut, self).__init__()