X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmanagers%2Fregistry_manager_pl.py;h=619e48153f7fee6d89b3174272a87c0f4896af0b;hb=9167ba6e1a70f1ff29619247f2d6f1509ae1652d;hp=686518ec332819a4bd98372901eba945bfdb9cda;hpb=3f916b7c26a39418d181e587065bdc7b88880c15;p=sfa.git diff --git a/sfa/managers/registry_manager_pl.py b/sfa/managers/registry_manager_pl.py index 686518ec..619e4815 100644 --- a/sfa/managers/registry_manager_pl.py +++ b/sfa/managers/registry_manager_pl.py @@ -69,7 +69,7 @@ def resolve(api, xrns, type=None, origin_hrn=None): # the longest matching prefix 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']])