- # update testbed-specific data f needed
- logger.info("Getting driver from manager=%s"%self)
- pointer = self.driver.register (record, hrn, pub_key)
+ elif isinstance (record, RegSlice):
+ # locate objects for relationships
+ if hasattr (record, 'researcher'):
+ # we get the list of researcher hrns as
+ researcher_hrns = record.researcher
+ # strip that in case we have <researcher> words </researcher>
+ researcher_hrns = [ x.strip() for x in researcher_hrns ]
+ logger.info ("incoming researchers %s"%researcher_hrns)
+ request = dbsession.query (RegUser).filter(RegUser.hrn.in_(researcher_hrns))
+ logger.info ("%d incoming hrns, %d matches found"%(len(researcher_hrns),request.count()))
+ researchers = dbsession.query (RegUser).filter(RegUser.hrn.in_(researcher_hrns)).all()
+ record.reg_researchers = researchers
+
+ elif isinstance (record, RegUser):
+ # create RegKey objects for incoming keys
+ if hasattr(record,'keys'):
+ logger.debug ("creating %d keys for user %s"%(len(record.keys),record.hrn))
+ record.reg_keys = [ RegKey (key) for key in record.keys ]
+
+ # update testbed-specific data if needed
+ pointer = self.driver.register (record.__dict__, hrn, pub_key)