UpdatePerson: fix the part of updating the person HRN tag
authorMohamed Larabi <mohamed.larabi@inria.fr>
Fri, 15 Nov 2013 16:39:21 +0000 (17:39 +0100)
committerMohamed Larabi <mohamed.larabi@inria.fr>
Fri, 15 Nov 2013 16:39:21 +0000 (17:39 +0100)
PLC/Methods/UpdatePerson.py

index 1874f13..3212ef5 100644 (file)
@@ -88,8 +88,9 @@ class UpdatePerson(Method):
 
         # if email was modifed make sure to update the hrn tag
         if 'email' in native:
-            old_hrn=PersonTags(self.api,{'tagname':'hrn','person_id':person['person_id']})[0]['value']
-            if old_hrn :
+            hrn_tag=PersonTags(self.api,{'tagname':'hrn','person_id':person['person_id']})
+            if hrn_tag:
+                old_hrn = hrn_tag[0]['value']
                 root_auth = self.api.config.PLC_HRN_ROOT
                 login_base = old_hrn.split('.')[-2]
                 hrn=email_to_hrn("%s.%s"%(root_auth,login_base),person['email'])