本文整理汇总了Python中model.Document.get_doc方法的典型用法代码示例。如果您正苦于以下问题:Python Document.get_doc方法的具体用法?Python Document.get_doc怎么用?Python Document.get_doc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Document
的用法示例。
在下文中一共展示了Document.get_doc方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: store_digest
# 需要导入模块: from model import Document [as 别名]
# 或者: from model.Document import get_doc [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 get_doc [as 别名]
def handle(self):
digest = self.request.get("d")
doc = Document.get_doc(digest)
if not doc or not doc.tx:
return {"success" : False, "error": "format"}
# TODO: add check to prevent double timestamping
tx, message = publish_data_old(doc)
do_check_document(digest)
return {"success" : True, "tx" : tx, "message" : message}
示例3: process_payment
# 需要导入模块: from model import Document [as 别名]
# 或者: from model.Document import get_doc [as 别名]
def process_payment(self, satoshis, digest):
secret = self.request.get("secret")
if len(digest) != 64 or secret != CALLBACK_SECRET or satoshis < MIN_SATOSHIS_PAYMENT:
return {"success" : False, "reason" : "format or payment below " + str(MIN_SATOSHIS_PAYMENT)}
doc = Document.get_doc(digest)
if not doc:
return {"success" : False, "reason" : "Couldn't find document"}
doc.pending = False
doc.put()
return {"success" : True}
示例4: handle
# 需要导入模块: from model import Document [as 别名]
# 或者: from model.Document import get_doc [as 别名]
def handle(self):
digest = self.request.get("d")
doc = Document.get_doc(digest)
if not digest:
return {"success": False, "reason": "format"}
if not doc:
return {"success": False, "reason": "nonexistent"}
if doc.tx:
return {"success": True, "status": "confirmed", "transaction": doc.tx}
if doc.is_actionable():
return {"success": True, "status": "pending"}
return {"success": True, "status": "registered"}
示例5: handle
# 需要导入模块: from model import Document [as 别名]
# 或者: from model.Document import get_doc [as 别名]
def handle(self):
digest = self.request.get("d")
doc = Document.get_doc(digest)
if not doc or doc.tx:
return {"success" : False, "error": "format"}
# TODO: add check to prevent double timestamping
txid, message = publish_data(doc.digest.decode('hex'))
if txid:
doc.tx = txid
doc.txstamp = datetime.datetime.now()
LatestBlockchainDocuments.get_inst().add_document(digest)
doc.put()
return {"success" : txid is not None, "tx" : txid, "message" : message}
示例6: handle
# 需要导入模块: from model import Document [as 别名]
# 或者: from model.Document import get_doc [as 别名]
def handle(self):
digest = self.request.get("d")
doc = Document.get_doc(digest)
if not doc or not doc.payment_address:
return {"success" : False, "error": "format"}
txs = get_txs_for_addr(doc.payment_address)
if not txs or len(txs) == 0:
return {"success" : False, "error": "no transactions"}
tx_hash, tx_timestamp = txs[0]
doc.confirmed(tx_hash, tx_timestamp)
LatestBlockchainDocuments.get_inst().add_document(doc)
return {"success" : True, "tx" : doc.tx}
示例7: handle
# 需要导入模块: from model import Document [as 别名]
# 或者: from model.Document import get_doc [as 别名]
def handle(self):
digest = self.request.get("d")
doc = Document.get_doc(digest)
if not digest:
return {"success": False, "reason": "format"}
if not doc:
return {"success": False, "reason": "nonexistent"}
if doc.tx:
return {"success": True, "status": "confirmed", "transaction": doc.tx, "txstamp": doc.txstamp}
if doc.is_actionable():
return {"success": True, "status": "pending"}
return {
"success": True,
"status": "registered",
"pay_address": doc.payment_address,
"price": MIN_SATOSHIS_PAYMENT,
}
示例8: handle
# 需要导入模块: from model import Document [as 别名]
# 或者: from model.Document import get_doc [as 别名]
def handle(self):
digest = self.request.get("d")
doc = Document.get_doc(digest)
if not doc:
return {"success" : False, "error": "format"}
return doc.blockchain_certify()
示例9: get
# 需要导入模块: from model import Document [as 别名]
# 或者: from model.Document import get_doc [as 别名]
def get(self):
digest = self.request.get('d')
d = Document.get_doc(digest)
if d and d.pending and d.has_balance():
d.received_payment()
self.response.write("%s %s<br />" % (d.digest, d.payment_address))