当前位置: 首页>>代码示例>>Python>>正文


Python Contract.delete方法代码示例

本文整理汇总了Python中market.contracts.Contract.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Contract.delete方法的具体用法?Python Contract.delete怎么用?Python Contract.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在market.contracts.Contract的用法示例。


在下文中一共展示了Contract.delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: delete_contract

# 需要导入模块: from market.contracts import Contract [as 别名]
# 或者: from market.contracts.Contract import delete [as 别名]
 def delete_contract(self, request):
     if "id" in request.args:
         c = Contract(hash_value=unhexlify(request.args["id"][0]))
         for keyword in c.contract["vendor_offer"]["listing"]["item"]["keywords"]:
             self.kserver.delete(keyword.lower(), c.get_contract_id(),
                                 KeyChain().signing_key.sign(c.get_contract_id())[:64])
         c.delete()
开发者ID:the9ull,项目名称:OpenBazaar-Server,代码行数:9,代码来源:restapi.py

示例2: delete_contract

# 需要导入模块: from market.contracts import Contract [as 别名]
# 或者: from market.contracts.Contract import delete [as 别名]
 def delete_contract(self, request):
     try:
         if "id" in request.args:
             file_path = self.db.HashMap().get_file(request.args["id"][0])
             with open(file_path, "r") as filename:
                 contract = json.load(filename, object_pairs_hook=OrderedDict)
             c = Contract(self.db, contract=contract)
             if "keywords" in c.contract["vendor_offer"]["listing"]["item"]:
                 for keyword in c.contract["vendor_offer"]["listing"]["item"]["keywords"]:
                     self.kserver.delete(
                         keyword.lower(),
                         c.get_contract_id(),
                         self.keychain.signing_key.sign(c.get_contract_id())[:64],
                     )
             if "delete_images" in request.args:
                 c.delete(delete_images=True)
             else:
                 c.delete()
         request.write(json.dumps({"success": True}))
         request.finish()
         return server.NOT_DONE_YET
     except Exception, e:
         request.write(json.dumps({"success": False, "reason": e.message}, indent=4))
         request.finish()
         return server.NOT_DONE_YET
开发者ID:HiroIshikawa,项目名称:OpenBazaar-Server,代码行数:27,代码来源:restapi.py

示例3: delete_contract

# 需要导入模块: from market.contracts import Contract [as 别名]
# 或者: from market.contracts.Contract import delete [as 别名]
 def delete_contract(self, request):
     try:
         if "id" in request.args:
             c = Contract(self.db, hash_value=unhexlify(request.args["id"][0]))
             for keyword in c.contract["vendor_offer"]["listing"]["item"]["keywords"]:
                 self.kserver.delete(keyword.lower(), c.get_contract_id(),
                                     self.keychain.signing_key.sign(c.get_contract_id())[:64])
             c.delete()
         request.write(json.dumps({"success": True}))
         request.finish()
         return server.NOT_DONE_YET
     except Exception, e:
         request.write(json.dumps({"success": False, "reason": e.message}, indent=4))
         request.finish()
         return server.NOT_DONE_YET
开发者ID:jamesdwilson,项目名称:OpenBazaar-Server,代码行数:17,代码来源:restapi.py


注:本文中的market.contracts.Contract.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。