fixing the argument mismatch
[sfa.git] / sfa / managers / registry_manager_pl.py
index 77fbf17..619e481 100644 (file)
@@ -67,9 +67,9 @@ def resolve(api, xrns, type=None, origin_hrn=None):
 
     # load all know registry names into a prefix tree and attempt to find
     # the longest matching prefix
-    if not isinstance(hrns, types.ListType):
+    if not isinstance(xrns, types.ListType):
         xrns = [xrns]
-    
+    hrns = [urn_to_hrn(xrn)[0] for xrn in xrns] 
     # create a dict whre key is an registry hrn and its value is a
     # hrns at that registry (determined by the known prefix tree).  
     xrn_dict = {}
@@ -100,6 +100,7 @@ def resolve(api, xrns, type=None, origin_hrn=None):
 
     # try resolving the remaining unfound records at the local registry
     remaining_hrns = set(hrns).difference([record['hrn'] for record in records])
+    # convert set to list
     remaining_hrns = [hrn for hrn in remaining_hrns] 
     table = SfaTable()
     local_records = table.findObjects({'hrn': remaining_hrns})
@@ -121,7 +122,7 @@ def resolve(api, xrns, type=None, origin_hrn=None):
 
     return records
 
-def list(api, xrn):
+def list(api, xrn, origin_hrn=None):
     hrn, type = urn_to_hrn(xrn)
     # load all know registry names into a prefix tree and attempt to find
     # the longest matching prefix
@@ -216,13 +217,13 @@ def register(api, record):
         for key in pl_record.keys():
             if key not in acceptable_fields:
                 pl_record.pop(key)
-            slices = api.plshell.GetSlices(api.plauth, [pl_record['name']])
-            if not slices:
-                pointer = api.plshell.AddSlice(api.plauth, pl_record)
-            else:
-                pointer = slices[0]['slice_id']
-            record.set_pointer(pointer)
-            record['pointer'] = pointer
+        slices = api.plshell.GetSlices(api.plauth, [pl_record['name']])
+        if not slices:
+             pointer = api.plshell.AddSlice(api.plauth, pl_record)
+        else:
+             pointer = slices[0]['slice_id']
+        record.set_pointer(pointer)
+        record['pointer'] = pointer
 
     elif  (type == "user"):
         persons = api.plshell.GetPersons(api.plauth, [record['email']])