fixed up the names of new site names/slices to be more PLC compatible
[sfa.git] / sfa / methods / list.py
index efbf8d3..206b5a5 100644 (file)
@@ -2,49 +2,33 @@
 ### $URL$
 
 from sfa.util.faults import *
+from sfa.util.namespace import *
 from sfa.util.method import Method
 from sfa.util.parameter import Parameter, Mixed
-from sfa.trust.auth import Auth
-from sfa.util.record import GeniRecord
+from sfa.util.record import SfaRecord
+from sfa.methods.List import List
 
-from sfa.server.registry import Registries
-
-class list(Method):
+class list(List):
     """
+    Deprecated. Use List instead.
+
     List the records in an authority. 
 
     @param cred credential string specifying the rights of the caller
-    @param hrn human readable name of authority to list
+    @param hrn human readable name of authority to list (hrn or urn)
     @return list of record dictionaries         
     """
-
     interfaces = ['registry']
     
     accepts = [
         Parameter(str, "Credential string"),
-        Parameter(str, "Human readable name (hrn)")
+        Parameter(str, "Human readable name (hrn or urn)"),
+        Mixed(Parameter(str, "Human readable name of the original caller"),
+              Parameter(None, "Origin hrn not specified"))
         ]
 
-    returns = [GeniRecord]
+    returns = [SfaRecord]
     
-    def call(self, cred, hrn):
-        
-        self.api.auth.check(cred, 'list')
-        records = []
-        try:
-            if not self.api.auth.hierarchy.auth_exists(hrn):
-                raise MissingAuthority(hrn)
-            table = self.api.auth.get_auth_table(hrn)   
-            records = table.list()
-        except MissingAuthority:
-            # is this a foreign authority
-            registries = Registries(self.api)
-            credential = self.api.getCredential()
-            for registry in registries:
-                if hrn.startswith(registry) and registry not in [self.api.hrn]:
-                    record_list = registries[registry].list(credential, hrn)
-                    for record in record_list:
-                        records.append(record.as_dict()) 
-                    return records
+    def call(self, cred, xrn, origin_hrn=None):
         
-        return records
+        return List.call(self, xrn, cred)