本文整理汇总了Python中model.Document.new方法的典型用法代码示例。如果您正苦于以下问题:Python Document.new方法的具体用法?Python Document.new怎么用?Python Document.new使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Document
的用法示例。
在下文中一共展示了Document.new方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: store_digest
# 需要导入模块: from model import Document [as 别名]
# 或者: from model.Document import new [as 别名]
def store_digest(self, digest):
docproof = Document.get_doc(digest)
if docproof:
return {"success" : False, "reason": "existing", "digest": digest, "args": [export_timestamp(docproof.timestamp)]}
d = Document.new(digest)
self.doc = d
return {"success": True, "digest": d.digest}
示例2: handle
# 需要导入模块: from model import Document [as 别名]
# 或者: from model.Document import new [as 别名]
def handle(self):
n = 0
for old in DocumentProof.all():
doc = Document.get_doc(old.digest)
if not doc:
doc = Document.new(old.digest)
doc.pending = old.tx == None
doc.tx = old.tx
doc.timestamp = old.timestamp
doc.blockstamp = old.blockstamp
n += 1
if n == 10:
break
return {"success" : True, "processed": n}