equal
deleted
inserted
replaced
1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
1 # copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
3 # |
3 # |
4 # This file is part of CubicWeb. |
4 # This file is part of CubicWeb. |
5 # |
5 # |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 """Exceptions shared by different cubicweb packages.""" |
18 """Exceptions shared by different cubicweb packages.""" |
19 |
19 |
20 __docformat__ = "restructuredtext en" |
20 __docformat__ = "restructuredtext en" |
21 |
21 |
22 from yams import ValidationError |
22 from yams import ValidationError as ValidationError |
23 |
23 |
24 # abstract exceptions ######################################################### |
24 # abstract exceptions ######################################################### |
25 |
25 |
26 class CubicWebException(Exception): |
26 class CubicWebException(Exception): |
27 """base class for cubicweb server exception""" |
27 """base class for cubicweb server exception""" |
98 if self.args and len(self.args) == 2: |
98 if self.args and len(self.args) == 2: |
99 return self.msg1 % self.args |
99 return self.msg1 % self.args |
100 if self.args: |
100 if self.args: |
101 return ' '.join(self.args) |
101 return ' '.join(self.args) |
102 return self.msg |
102 return self.msg |
103 except Exception, ex: |
103 except Exception as ex: |
104 return str(ex) |
104 return str(ex) |
105 |
105 |
106 class Forbidden(SecurityError): |
106 class Forbidden(SecurityError): |
107 """raised when a user tries to perform a forbidden action |
107 """raised when a user tries to perform a forbidden action |
108 """ |
108 """ |