def setAltId(self,value): try: regConfig = DBSession().query(MolRegConfig).get(value) self.mol_reg_id = regConfig.getRegId() except Exception,e: log.exception(e) raise Exception("Configure your registry id prefix first using the 'Configure' link.")
def setUp(self): super(TestStudy,self).setUp() self.program=DBSession().query(Program).first() self.org=DBSession().query(Org).first() self.user = User.by_user_name('studyuser') mrc = DBSession().query(MolRegConfig).first() self.prefix_id = mrc.id_prefix s=Study() s.title = 'Test title' s.description = 'Test description' s.uuid = uuid.uuid4().hex s.created_by_id = self.user.user_id s.program_id = self.program.program_id s.org_id = self.org.org_id DBSession().add(s) DBSession().flush() self.study_id = s.id benz=Mol() benz.mol_struct = benzene benz.mol_reg_id = mrc.getRegId() benz = mergeMol(benz) imid=Mol() imid.mol_struct = imidazole imid.mol_reg_id = mrc.getRegId() imid = mergeMol(imid) transaction.commit() self.study = Study.byId(self.study_id) self.program=DBSession().query(Program).first() self.org=DBSession().query(Org).first() self.user = User.by_user_name('studyuser')