本文整理匯總了Python中app.model.DBSession.witness_id方法的典型用法代碼示例。如果您正苦於以下問題:Python DBSession.witness_id方法的具體用法?Python DBSession.witness_id怎麽用?Python DBSession.witness_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app.model.DBSession
的用法示例。
在下文中一共展示了DBSession.witness_id方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: clone
# 需要導入模塊: from app.model import DBSession [as 別名]
# 或者: from app.model.DBSession import witness_id [as 別名]
def clone(self, owner=None):
crxn = saClone(self)
newRxn = DBSession().merge(crxn)
newRxn.rxn_program_id = None
newRxn.rxn_org_id = None
newRxn.completed_by_id = None
newRxn.date_completed = None
newRxn.date_created = None
newRxn.rxn_notebook_id = None
newRxn.rxn_notebook_page = None
newRxn.date_witnessed = None
newRxn.witness_id = None
newRxn.date_created = datetime.datetime.now()
for reagent in self.reagents:
newr = saClone(reagent)
# Update stoich-to-protocol links
newr.uuid = uuid.uuid4().hex
newRxn.reagents.append(newr)
if newRxn.rxn_protocol:
newRxn.rxn_protocol = newRxn.rxn_protocol.replace(reagent.uuid, newr.uuid)
for product in self.products:
newp = saClone(product)
# Update stoich-to-protocol links
newp.uuid = uuid.uuid4().hex
# Clear out things which can't be known until reaction is complete
newp.amount = None
newp.submitted_amount = None
newp.pct_yield = None
newp.purity = None
newp.barcode = None
newRxn.products.append(newp)
if newRxn.rxn_protocol:
newRxn.rxn_protocol = newRxn.rxn_protocol.replace(product.uuid, newp.uuid)
newRxn.owner = owner
return newRxn