This change fixes the WSDL build. I am aware that it removes a bit of flexibility...
[sfa.git] / sfa / methods / get_registries.py
index ed46b5a..e928aa2 100644 (file)
@@ -1,6 +1,6 @@
 ### $Id: get_slices.py 14387 2009-07-08 18:19:11Z faiyaza $
 ### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/methods/get_registries.py $
-
+from types import StringTypes
 from sfa.util.faults import *
 from sfa.util.misc import *
 from sfa.util.method import Method
@@ -21,8 +21,8 @@ class get_registries(Method):
     
     accepts = [
         Parameter(str, "Credential string"),
-        Mixed([Parameter(str, "Human readable name (hrn)")],
-              Parameter(str, "Human readable name (hrn)"),
+        
+        Mixed(Parameter(str, "Human readable name (hrn)"),
               Parameter(None, "hrn not specified"))  
         ]
 
@@ -32,4 +32,17 @@ class get_registries(Method):
        
         self.api.auth.check(cred, 'list')
         registries = Registries(self.api)
+        hrn_list = []
+        if hrn:
+            if isinstance(hrn, StringTypes):
+                hrn_list = [hrn]
+            elif isinstance(hrn, list):
+                hrn_list = hrn
+
+        if not hrn_list:
+            interfaces = registries.interfaces
+        else:
+            interfaces = [interface for interface in registries.interfaces if interface['hrn'] in hrn_list]
+
+        return interfaces
         return registries.interfaces