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


Python Common.generate_alphanum_key方法代码示例

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


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

示例1: _test_multi_input

# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import generate_alphanum_key [as 别名]
    def _test_multi_input(my):

        # Disabled for now
        return

        # create a dummy sobject
        sobject = SearchType.create("sthpw/virtual")
        code = "test%s" % Common.generate_alphanum_key()
        sobject.set_value("code", code)


        #search = Search("sthpw/message")
        #sobjects = search.get_sobjects()
        #for sobject in sobjects:
        #    sobject.delete()



        # simple condition
        pipeline_xml = '''
        <pipeline>
          <process type="action" name="a"/>
          <process type="action" name="b1"/>
          <process type="action" name="b2"/>
          <process type="action" name="b3"/>
          <process type="action" name="b4"/>
          <process type="action" name="c"/>
          <process type="action" name="d"/>
          <connect from="a" to="b1"/>
          <connect from="a" to="b2"/>
          <connect from="a" to="b3"/>
          <connect from="a" to="b4"/>
          <connect from="b1" to="c"/>
          <connect from="b2" to="c"/>
          <connect from="b3" to="c"/>
          <connect from="b4" to="c"/>
          <connect from="c" to="d"/>
        </pipeline>
        '''
        pipeline, processes = my.get_pipeline(pipeline_xml)


        process = processes.get("c")
        process.set_json_value("workflow", {
            'on_action': '''
            print "c: running action"
            '''
        } )
        process.commit()


        # Run the pipeline
        process = "a"
        output = {
            "pipeline": pipeline,
            "sobject": sobject,
            "process": process
        }
        Trigger.call(my, "process|pending", output)
开发者ID:jayvdb,项目名称:TACTIC,代码行数:61,代码来源:workflow_test.py

示例2: _test_multi_input

# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import generate_alphanum_key [as 别名]
    def _test_multi_input(self):

        # create a dummy sobject
        sobject = SearchType.create("sthpw/virtual")
        code = "test%s" % Common.generate_alphanum_key()
        sobject.set_value("code", code)



        # simple condition
        pipeline_xml = '''
        <pipeline>
          <process type="action" name="a"/>
          <process type="action" name="b1"/>
          <process type="action" name="b2"/>
          <process type="action" name="b3"/>
          <process type="action" name="b4"/>
          <process type="action" name="c"/>
          <process type="action" name="d"/>
          <connect from="a" to="b1"/>
          <connect from="a" to="b2"/>
          <connect from="a" to="b3"/>
          <connect from="a" to="b4"/>
          <connect from="b1" to="c"/>
          <connect from="b2" to="c"/>
          <connect from="b3" to="c"/>
          <connect from="b4" to="c"/>
          <connect from="c" to="d"/>
        </pipeline>
        '''
        pipeline, processes = self.get_pipeline(pipeline_xml)


        process = processes.get("c")
        process.commit()

        # Run the pipeline
        process = "a"
        output = {
            "pipeline": pipeline,
            "sobject": sobject,
            "process": process
        }
        Trigger.call(self, "process|pending", output)
       
        self.assertEquals( "complete", sobject.get_value("a"))
        self.assertEquals( "complete", sobject.get_value("b1"))
        self.assertEquals( "complete", sobject.get_value("b2"))
        self.assertEquals( "complete", sobject.get_value("b3"))
        self.assertEquals( "complete", sobject.get_value("b4"))
        self.assertEquals( "complete", sobject.get_value("c"))
        self.assertEquals( "complete", sobject.get_value("d"))
开发者ID:mincau,项目名称:TACTIC,代码行数:54,代码来源:workflow_test.py

示例3: _test_trigger

# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import generate_alphanum_key [as 别名]
    def _test_trigger(my):

        # create a dummy sobject
        sobject = SearchType.create("unittest/person")

        pipeline_xml = '''
        <pipeline>
          <process type="action" name="a"/>
        </pipeline>
        '''
        pipeline, processes = my.get_pipeline(pipeline_xml)

        process = processes.get("a")
        process.set_value("workflow", "")
        process.commit()


        folder = Common.generate_alphanum_key()

        Trigger.clear_db_cache()
        event = "process|action"
        trigger = SearchType.create("config/trigger")
        trigger.set_value("event", event)
        trigger.set_value("process", process.get_code())
        trigger.set_value("mode", "same process,same transaction")
        trigger.set_value("script_path", "%s/process_trigger" % folder)
        trigger.commit()

        script = SearchType.create("config/custom_script")
        script.set_value("folder", folder)
        script.set_value("title", "process_trigger")
        script.set_value("script", '''
        print "---"
        for key, value in input.items():
            print key, value
        print "---"
        print "process: ", input.get("process")
        ''')
        script.commit()
 
        # Run the pipeline
        process = "a"
        output = {
            "pipeline": pipeline,
            "sobject": sobject,
            "process": process
        }
        Trigger.call(my, "process|pending", output)
开发者ID:jayvdb,项目名称:TACTIC,代码行数:50,代码来源:workflow_test.py

示例4: _test_multi_input_reject

# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import generate_alphanum_key [as 别名]
    def _test_multi_input_reject(self):

        # create a dummy sobject
        sobject = SearchType.create("sthpw/virtual")
        code = "test%s" % Common.generate_alphanum_key()
        sobject.set_value("code", code)
        sobject.set_value("a1", "complete")
        sobject.set_value("a2", "complete")
        sobject.set_value("a3", "complete")
        sobject.set_value("b", "pending")

        # simple condition
        pipeline_xml = '''
        <pipeline>
          <process type="action" name="a1"/>
          <process type="action" name="a2"/>
          <process type="action" name="a3"/>
          <process type="approval" name="b"/>
          <connect from="a1" to="b"/>
          <connect from="a2" to="b"/>
          <connect from="a3" to="b"/>
        </pipeline>
        '''
        pipeline, processes = self.get_pipeline(pipeline_xml)


        # Run the pipeline
        process = "b"
        output = {
            "pipeline": pipeline,
            "sobject": sobject,
            "process": process,
            "reject_process": ['a1', 'a3']
        }
        Trigger.call(self, "process|reject", output)

        self.assertEquals( "revise", sobject.get_value("a1"))
        self.assertEquals( "complete", sobject.get_value("a2"))
        self.assertEquals( "revise", sobject.get_value("a3"))
开发者ID:mincau,项目名称:TACTIC,代码行数:41,代码来源:workflow_test.py

示例5: _test_multi_input_complete

# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import generate_alphanum_key [as 别名]
    def _test_multi_input_complete(self):

        # DISABLE until check_inputs is called
        return

        # create a dummy sobject
        sobject = SearchType.create("sthpw/virtual")
        code = "test%s" % Common.generate_alphanum_key()
        sobject.set_value("code", code)



        # simple condition
        pipeline_xml = '''
        <pipeline>
          <process type="action" name="a"/>
          <process type="manual" name="b1"/>
          <process type="manual" name="b2"/>
          <process type="manual" name="b3"/>
          <process type="action" name="c"/>
          <connect from="a" to="b1"/>
          <connect from="a" to="b2"/>
          <connect from="a" to="b3"/>
          <connect from="a" to="b4"/>
          <connect from="b1" to="c"/>
          <connect from="b2" to="c"/>
          <connect from="b3" to="c"/>
        </pipeline>
        '''
        pipeline, processes = self.get_pipeline(pipeline_xml)


        process = processes.get("c")
        process.commit()

        # Run the pipeline
        process = "a"
        output = {
            "pipeline": pipeline,
            "sobject": sobject,
            "process": process
        }
        Trigger.call(self, "process|pending", output)


        # Run the pipeline
        process = "b1"
        output = {
            "pipeline": pipeline,
            "sobject": sobject,
            "process": process
        }
        Trigger.call(self, "process|complete", output)

       
        self.assertEquals( "complete", sobject.get_value("a"))
        self.assertEquals( "complete", sobject.get_value("b1"))
        self.assertEquals( "pending", sobject.get_value("b2"))
        self.assertEquals( "pending", sobject.get_value("b3"))

        # THIS WILL FAIL until we implement this correctly
        self.assertEquals( "pending", sobject.get_value("c"))
开发者ID:mincau,项目名称:TACTIC,代码行数:64,代码来源:workflow_test.py


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