From: Tony Mack Date: Mon, 10 Aug 2009 18:19:42 +0000 (+0000) Subject: After adding the record to the plc db, check if the record exists in sfa db. sfa... X-Git-Tag: sfa-0.9-1~110 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=8b29a3f5915b7131010a11d52cdf83395d5c0f09;p=sfa.git After adding the record to the plc db, check if the record exists in sfa db. sfa upcalls in PLCAPI may have already added the record so if we blindly add them in register we will have duplicates --- diff --git a/sfa/methods/register.py b/sfa/methods/register.py index ef4f1867..00ec0757 100644 --- a/sfa/methods/register.py +++ b/sfa/methods/register.py @@ -119,7 +119,11 @@ class register(Method): else: raise UnknownGeniType(type) - table.insert(record) + # SFA upcalls may exist in PLCAPI and they could have already added the + # record for us. Lets check if the record already exists + existing_records = table.resolve(type, name) + if not existing_records: + table.insert(record) # update membership for researchers, pis, owners, operators self.api.update_membership(None, record)