當前位置: 首頁>>代碼示例>>Python>>正文


Python DBSession.mol方法代碼示例

本文整理匯總了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
開發者ID:aytsai,項目名稱:ricebowl,代碼行數:13,代碼來源:grids.py

示例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]
開發者ID:aytsai,項目名稱:ricebowl,代碼行數:33,代碼來源:grids.py


注:本文中的app.model.DBSession.mol方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。