from sfa.trust.certificate import Certificate, Keypair, convert_public_key
from sfa.trust.gid import create_uuid
-from sfa.storage.model import make_record,RegRecord
+from sfa.storage.model import make_record, RegRecord, RegUser
from sfa.storage.alchemy import dbsession
class RegistryManager:
gid = auth_info.get_gid_object()
record.gid=gid.save_to_string(save_parents=True)
+ # post-process / cleanup for relation ships
+ if isinstance (record, RegUser):
+ record.normalize_xml()
+
# update testbed-specific data if needed
pointer = self.driver.register (record.__dict__, hrn, pub_key)
email = Column ('email', String)
# can't use name 'keys' here because when loading from xml we're getting
# a 'keys' tag, and assigning a list of strings in a reference column like this crashes
- reg_keys = relationship ('RegKey', backref='reg_user')
+ reg_keys = relationship ('RegKey', backref='reg_user')
def __init__ (self, **kwds):
# handle local settings
assert '@' in address
return address
+ def normalize_xml (self):
+ if hasattr(self,'keys'): self.reg_keys = [ RegKey (key) for key in self.keys ]
+
####################
# xxx tocheck : not sure about eager loading of this one
# meaning, when querying the whole records, we expect there should
xml_dict = xml_record.todict()
logger.info("load from xml, keys=%s"%xml_dict.keys())
return make_record_dict (xml_dict)
+