From: Anil-Kumar Vengalil <Anil-Kumar.Vengalil@sophia.inria.fr>
Date: Tue, 15 Sep 2009 15:37:57 +0000 (+0000)
Subject: if there are two accounts with the same e-mail on a remote peer, use the one with... 
X-Git-Tag: sfa-0.9-2~18
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=5a672ac9ae3345f012b97045d9772e860941a330;p=sfa.git

if there are two accounts with the same e-mail on a remote peer, use the one with peer_id set
---

diff --git a/sfa/plc/slices.py b/sfa/plc/slices.py
index 1e486a5b..c8905b04 100644
--- a/sfa/plc/slices.py
+++ b/sfa/plc/slices.py
@@ -243,7 +243,11 @@ class Slices(SimpleStorage):
             if not person_record:
                 pass
             person_dict = person_record.as_dict()
-            persons = self.api.plshell.GetPersons(self.api.plauth, [person_dict['email']], ['person_id', 'key_ids'])
+	    if peer:
+	       peer_id=self.api.plshell.GetPeers(self.api.plauth, {'shortname' : peer}, ['peer_id'])[0]['peer_id']
+               persons = self.api.plshell.GetPersons(self.api.plauth, {'email' : [person_dict['email']], 'peer_id' : peer_id}, ['person_id', 'key_ids'])
+	    else:
+               persons = self.api.plshell.GetPersons(self.api.plauth, [person_dict['email']], ['person_id', 'key_ids'])
 
             # Create the person record 
             if not persons: