X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fplanetlab%2Fplslices.py;h=0f4bd20b769c0ec584e50a94d0d77b5e5cf41afb;hb=bacb024c0fca1d2a5dfe3e31e047a709ef1b293d;hp=ed956874fb280082b51f15e4bbe8e76670b598e3;hpb=feae32b7b770f549392ed4802d48f7c66a09fda5;p=sfa.git diff --git a/sfa/planetlab/plslices.py b/sfa/planetlab/plslices.py index ed956874..0f4bd20b 100644 --- a/sfa/planetlab/plslices.py +++ b/sfa/planetlab/plslices.py @@ -503,8 +503,12 @@ class PlSlices: # about the last 2 sets, for managing keys, we need to trace back person_id -> user # and for this we need all the Person objects; we already have the target_existing ones - target_created_persons = self.driver.shell.GetPersons ({'peer_id':None, 'person_id':target_created_person_ids},person_fields) - persons_by_person_id = { person['person_id'] : person for person in target_existing_persons + target_created_persons } + # also we avoid issuing a call if possible + target_created_persons = [] if not target_created_person_ids \ + else driver.shell.GetPersons ({'peer_id':None, 'person_id':target_created_person_ids}, + person_fields) + persons_by_person_id = { person['person_id'] : person \ + for person in target_existing_persons + target_created_persons } def user_by_person_id (person_id): person = persons_by_person_id [person_id]