X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Futil%2Ffaults.py;h=07335b7ca043b20ea38328ec04e1382229dc9df1;hb=3c9b4d0e434d536c471d225e01723a61af544cb1;hp=045e443a1aeed5f5a95dd103383dc01fb5fae806;hpb=9133202ba370575aa6b1db0cfb5ec0668c7ea5f8;p=sfa.git diff --git a/sfa/util/faults.py b/sfa/util/faults.py index 045e443a..07335b7c 100644 --- a/sfa/util/faults.py +++ b/sfa/util/faults.py @@ -1,17 +1,13 @@ # # SFA API faults # -# - -### $Id$ -### $URL$ import xmlrpclib class SfaFault(xmlrpclib.Fault): def __init__(self, faultCode, faultString, extra = None): if extra: - faultString += ": " + extra + faultString += ": " + str(extra) xmlrpclib.Fault.__init__(self, faultCode, faultString) class SfaInvalidAPIMethod(SfaFault): @@ -55,8 +51,10 @@ class SfaPermissionDenied(SfaFault): SfaFault.__init__(self, 108, faultString, extra) class SfaNotImplemented(SfaFault): - def __init__(self, extra = None): - faultString = "Not fully implemented" + def __init__(self, interface=None, extra = None): + faultString = "Not implemented" + if interface: + faultString += " at interface " + interface SfaFault.__init__(self, 109, faultString, extra) class SfaAPIError(SfaFault): @@ -95,7 +93,8 @@ class ExistingRecord(SfaFault): SfaFault.__init__(self, 111, faultString, extra) def __str__(self): return repr(self.value) - + + class NonexistingCredType(SfaFault): def __init__(self, value, extra = None): self.value = value @@ -105,7 +104,7 @@ class NonexistingCredType(SfaFault): return repr(self.value) class NonexistingFile(SfaFault): - def __init__(self, value): + def __init__(self, value, extra = None): self.value = value faultString = "Non existing file: %(value)s, " % locals() SfaFault.__init__(self, 111, faultString, extra) @@ -113,7 +112,7 @@ class NonexistingFile(SfaFault): return repr(self.value) class InvalidRPCParams(SfaFault): - def __init__(self, value): + def __init__(self, value, extra = None): self.value = value faultString = "Invalid RPC Params: %(value)s, " % locals() SfaFault.__init__(self, 102, faultString, extra) @@ -217,7 +216,15 @@ class CertNotSignedByParent(SfaFault): SfaFault.__init__(self, 103, faultString, extra) def __str__(self): return repr(self.value) - + +class GidParentHrn(SfaFault): + def __init__(self, value, extra = None): + self.value = value + faultString = "Cert URN is not an extension of its parent: %(value)s" % locals() + SfaFault.__init__(self, 103, faultString, extra) + def __str__(self): + return repr(self.value) + class GidInvalidParentHrn(SfaFault): def __init__(self, value, extra = None): self.value = value @@ -235,7 +242,7 @@ class SliverDoesNotExist(SfaFault): return repr(self.value) class BadRequestHash(xmlrpclib.Fault): - def __init__(self, hash = None): + def __init__(self, hash = None, extra = None): faultString = "bad request hash: " + str(hash) xmlrpclib.Fault.__init__(self, 902, faultString) @@ -270,3 +277,17 @@ class AccountNotEnabled(SfaFault): def __str__(self): return repr(self.value) +class CredentialNotVerifiable(SfaFault): + def __init__(self, value, extra = None): + self.value = value + faultString = "Unable to verify credential: %(value)s, " %locals() + SfaFault.__init__(self, 115, faultString, extra) + def __str__(self): + return repr(self.value) + +class CertExpired(SfaFault): + def __init__(self, value, extra=None): + self.value = value + faultString = "%s cert is expired" % value + SfaFault.__init__(self, 102, faultString, extra) +