web/_exceptions.py
brancholdstable
changeset 5422 0865e1e90674
parent 5421 8167de96c523
child 5423 e15abfdcce38
child 5424 8ecbcbff9777
equal deleted inserted replaced
4985:02b52bf9f5f8 5422:0865e1e90674
     1 # pylint: disable-msg=W0401,W0614
     1 # pylint: disable-msg=W0401,W0614
       
     2 # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
       
     3 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
       
     4 #
       
     5 # This file is part of CubicWeb.
       
     6 #
       
     7 # CubicWeb is free software: you can redistribute it and/or modify it under the
       
     8 # terms of the GNU Lesser General Public License as published by the Free
       
     9 # Software Foundation, either version 2.1 of the License, or (at your option)
       
    10 # any later version.
       
    11 #
       
    12 # logilab-common is distributed in the hope that it will be useful, but WITHOUT
       
    13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
       
    14 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
       
    15 # details.
       
    16 #
       
    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/>.
     2 """exceptions used in the core of the CubicWeb web application
    19 """exceptions used in the core of the CubicWeb web application
     3 
    20 
     4 :organization: Logilab
       
     5 :copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
       
     6 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
       
     7 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
       
     8 """
    21 """
     9 __docformat__ = "restructuredtext en"
    22 __docformat__ = "restructuredtext en"
    10 
    23 
    11 from cubicweb._exceptions import *
    24 from cubicweb._exceptions import *
    12 
    25 
    51 
    64 
    52 class RemoteCallFailed(RequestError):
    65 class RemoteCallFailed(RequestError):
    53     """raised when a json remote call fails
    66     """raised when a json remote call fails
    54     """
    67     """
    55     def __init__(self, reason=''):
    68     def __init__(self, reason=''):
    56         #super(RequestError, self).__init__() # XXX require py >= 2.5
    69         super(RequestError, self).__init__()
    57         RequestError.__init__(self)
       
    58         self.reason = reason
    70         self.reason = reason
    59 
    71 
    60     def dumps(self):
    72     def dumps(self):
    61         import simplejson
    73         from cubicweb.web import json
    62         return simplejson.dumps({'reason': self.reason})
    74         return json.dumps({'reason': self.reason})