本文整理汇总了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