本文整理汇总了Python中com.googlecode.fascinator.common.JsonSimple.put方法的典型用法代码示例。如果您正苦于以下问题:Python JsonSimple.put方法的具体用法?Python JsonSimple.put怎么用?Python JsonSimple.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.googlecode.fascinator.common.JsonSimple
的用法示例。
在下文中一共展示了JsonSimple.put方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __activate__
# 需要导入模块: from com.googlecode.fascinator.common import JsonSimple [as 别名]
# 或者: from com.googlecode.fascinator.common.JsonSimple import put [as 别名]
def __activate__(self, context):
request = context["request"]
storage = context["Services"].getStorage()
auth = context["page"].authentication
log = context["log"]
username = auth.get_name()
oid = request.getParameter("oid")
approval = request.getParameter("approval")
approval_comment = request.getParameter("approval_comment")
storedObj = storage.getObject(oid)
committeeResponses = None
payloadList = storedObj.getPayloadIdList()
if payloadList.contains("committee-responses.metadata"):
committeeResponsePayload = storedObj.getPayload("committee-responses.metadata")
committeeResponses = JsonSimple(committeeResponsePayload.open()).getJsonObject()
else:
committeeResponses = JsonObject()
committeeResponse = JsonObject()
committeeResponse.put("approval",approval)
committeeResponse.put("approval_comment",approval_comment)
committeeResponses.put(username,committeeResponse)
log.debug(" %s: Committee %s, approval = %s, comment = %s" % ( oid, username, approval, approval_comment))
StorageUtils.createOrUpdatePayload(storedObj,"committee-responses.metadata",IOUtils.toInputStream(committeeResponses.toString(), "UTF-8"))
context["response"].sendRedirect(context["portalPath"] +"/detail/"+oid)
示例2: get_file_list_as_json
# 需要导入模块: from com.googlecode.fascinator.common import JsonSimple [as 别名]
# 或者: from com.googlecode.fascinator.common.JsonSimple import put [as 别名]
def get_file_list_as_json(self, rootPath, pattern):
json = JsonSimple().getJsonObject()
for root, dirs, files in os.walk(rootPath):
for filename in fnmatch.filter(files, pattern):
match = os.path.join(root, filename)
self.log.debug("appending %s to file list" % match)
json.put(match, filename)
return json
示例3: updatePackageType
# 需要导入模块: from com.googlecode.fascinator.common import JsonSimple [as 别名]
# 或者: from com.googlecode.fascinator.common.JsonSimple import put [as 别名]
def updatePackageType(self, tfPackage, toWorkflowId):
tfPackageJson = JsonSimple(tfPackage.open()).getJsonObject()
tfPackageJson.put("packageType", toWorkflowId)
inStream = IOUtils.toInputStream(tfPackageJson.toString(), "UTF-8")
try:
StorageUtils.createOrUpdatePayload(self.object, tfPackage.getId(), inStream)
except StorageException:
print " ERROR updating dataset payload"
示例4: updateWorkFlowMetadata
# 需要导入模块: from com.googlecode.fascinator.common import JsonSimple [as 别名]
# 或者: from com.googlecode.fascinator.common.JsonSimple import put [as 别名]
def updateWorkFlowMetadata(self, workflowMetadata, toWorkflowId, toWorkflowStage):
workflowMetaDataJson = JsonSimple(workflowMetadata.open()).getJsonObject()
workflowMetaDataJson.put("id", toWorkflowId)
workflowMetaDataJson.put("step", toWorkflowStage)
inStream = IOUtils.toInputStream(workflowMetaDataJson.toString(), "UTF-8")
try:
StorageUtils.createOrUpdatePayload(self.object, "workflow.metadata", inStream)
except StorageException:
print " ERROR updating dataset payload"
示例5: get_file_contents_as_json
# 需要导入模块: from com.googlecode.fascinator.common import JsonSimple [as 别名]
# 或者: from com.googlecode.fascinator.common.JsonSimple import put [as 别名]
def get_file_contents_as_json(self, path):
json = JsonSimple().getJsonObject()
json.put(path, self.get_file_contents(path))
return json