deal with 'pi' vs 'reg-pis'
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Sun, 4 May 2014 20:37:25 +0000 (16:37 -0400)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Sun, 4 May 2014 20:37:25 +0000 (16:37 -0400)
sfa/client/sfaadmin.py
sfa/client/sfi.py
sfa/managers/registry_manager.py

index cf88a3a..1ba5f22 100755 (executable)
@@ -110,7 +110,7 @@ class RegistryCommands(Commands):
         if email:
             record_dict['email'] = email
         if pis:
-            record_dict['pi'] = pis
+            record_dict['reg-pis'] = pis
         if extras:
             record_dict.update(extras)
         return record_dict
index 3a61bff..e21a618 100644 (file)
@@ -209,7 +209,7 @@ def load_record_from_opts(options):
     if hasattr(options, 'email') and options.email:
         record_dict['email'] = options.email
     if hasattr(options, 'pis') and options.pis:
-        record_dict['pi'] = options.pis
+        record_dict['reg-pis'] = options.pis
 
     # handle extra settings
     record_dict.update(options.extras)
index 7943809..7306380 100644 (file)
@@ -57,6 +57,7 @@ def _normalize_input (record, reg_key, driver_key):
 
 def normalize_input_record (record):
     _normalize_input (record, 'reg-researchers','researcher')
+    _normalize_input (record, 'reg-pis','pi')
     return record
 
 class RegistryManager:
@@ -378,7 +379,7 @@ class RegistryManager:
             record.gid=gid.save_to_string(save_parents=True)
 
             # locate objects for relationships
-            pi_hrns = getattr(record,'pi',None)
+            pi_hrns = getattr(record,'reg-pis',None)
             if pi_hrns is not None: record.update_pis (pi_hrns, dbsession)
 
         elif isinstance (record, RegSlice):
@@ -451,7 +452,7 @@ class RegistryManager:
             if researcher_hrns is not None: record.update_researchers (researcher_hrns, dbsession)
 
         elif isinstance (record, RegAuthority):
-            pi_hrns = getattr(new_record,'pi',None)
+            pi_hrns = getattr(new_record,'reg-pis',None)
             if pi_hrns is not None: record.update_pis (pi_hrns, dbsession)
         
         # update the PLC information that was specified with the record