BaseApi.get_interface_manager() wraps the manager module/library in a ManagerWrapper...
[sfa.git] / sfa / util / faults.py
index d1f070c..8bf71e8 100644 (file)
@@ -11,7 +11,7 @@ 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 +55,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 +97,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 +108,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 +116,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)
@@ -143,8 +146,8 @@ class RecordNotFound(SfaFault):
         self.value = value
         faultString = "Record not found: %(value)s" % locals()
         SfaFault.__init__(self, 102, faultString, extra)
-    #def __str__(self):
-    #    return repr(self.value)
+    def __str__(self):
+        return repr(self.value)
 
 class UnknownSfaType(SfaFault):
     def __init__(self, value, extra = None):
@@ -217,7 +220,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 +246,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)
 
@@ -263,3 +274,17 @@ class InvalidRSpec(SfaFault):
     def __str__(self):
         return repr(self.value)
 
+class AccountNotEnabled(SfaFault):
+    def __init__(self,  extra = None):
+        faultString = "Account Disabled"
+        SfaFault.__init__(self, 108, faultString, extra)
+    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)