trimmed useless imports, unstarred all imports
[sfa.git] / sfa / methods / get_registries.py
index 9cbba39..65d9444 100644 (file)
@@ -1,11 +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.namespace import *
+from sfa.util.xrn import urn_to_hrn
 from sfa.util.method import Method
 from sfa.util.parameter import Parameter, Mixed
-from sfa.trust.auth import Auth
 from sfa.server.registry import Registries
 
 class get_registries(Method):
@@ -30,17 +25,7 @@ class get_registries(Method):
     def call(self, cred, xrn = None):
         hrn, type = urn_to_hrn(xrn)
         self.api.auth.check(cred, 'list')
-        registries = Registries(self.api)
-        hrn_list = []
+        registries = Registries(self.api).values()
         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
+            registries = [reg for reg in registries if reg['hrn'] == hrn] 
+        return registries