本文整理汇总了Python中app.model.DBSession.mol方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.mol方法的具体用法?Python DBSession.mol怎么用?Python DBSession.mol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.model.DBSession
的用法示例。
在下文中一共展示了DBSession.mol方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: gridUpdate
# 需要导入模块: from app.model import DBSession [as 别名]
# 或者: from app.model.DBSession import mol [as 别名]
def gridUpdate(self, modelObjects,row):
request = modelObjects[Request]
requestItem = modelObjects[RequestItem]
mol = modelObjects[Mol]
mols = DBSession().query(Mol).filter(Mol.mol_reg_id==mol.mol_reg_id).all()
if len(mols)==0:
raise ClientException(mol.mol_reg_id + " was not found in the database")
mol = mols[0]
item = DBSession().merge(requestItem)
item.mol = mol
return mol,item,request
示例2: checkModifyRxnMol
# 需要导入模块: from app.model import DBSession [as 别名]
# 或者: from app.model.DBSession import mol [as 别名]
try:
rxnMol=register.mergeMol(rxnMol)
# Default state is solid if not set
if not rxnMol.state:
rxnMol.state = 'solid'
if mol_name and mol_name != rxnMol.mol_name or mol_cas_no and mol_cas_no != rxnMol.mol_cas_no:
checkModifyRxnMol(request.identity['user'], request.identity['permissions'], rxnMol)
rxnMol.mol_name = mol_name
rxnMol.mol_cas_no = mol_cas_no
updateRxnProtocolsAndNamesFromMol(rxnMol)
except register.MissingUniqueAttrError,e:
raise ClientException('You must draw a structure, enter a CAS number or enter a compound name.')
except Exception,e:
raise e
c=DBSession().merge(rxnComponent)
c.mol=rxnMol
checkModifyRxn(request.identity['user'], request.identity['permissions'], c.rxn)
DBSession().flush()
return rxnMol, c
def gridDelete(self,modelObjects):
rxnComponent = self._rxnComponent(modelObjects)
rxnComponent = DBSession().merge(rxnComponent)
rxnComponent.lotSalts = []
checkModifyRxn(request.identity['user'], request.identity['permissions'], rxnComponent.rxn)
DBSession().delete(rxnComponent)
def _rxnComponent(self, modelObjects):
rxnComponent=modelObjects[self.rptCfg.pkcol.modelClass]