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


Python JsonSimple.put方法代码示例

本文整理汇总了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)
开发者ID:qcif,项目名称:qcloud-arms,代码行数:33,代码来源:committee.py

示例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
开发者ID:the-fascinator,项目名称:fascinator-portal,代码行数:10,代码来源:listFileNames.py

示例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"            
开发者ID:greg-pendlebury,项目名称:redbox,代码行数:11,代码来源:TransitionWorkflow.py

示例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"
开发者ID:jonhurn,项目名称:redbox,代码行数:11,代码来源:TransitionWorkflow.py

示例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
开发者ID:the-fascinator,项目名称:fascinator-portal,代码行数:6,代码来源:listFileNames.py


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