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


Python Trigger.clear_db_cache方法代码示例

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


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

示例1: _test_trigger

# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import clear_db_cache [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

示例2: execute

# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import clear_db_cache [as 别名]
    def execute(self):

        Trigger.clear_db_cache()

        event = "change|config/widget_config"
        trigger = SearchType.create("sthpw/trigger")
        trigger.set_value("event", event)
        trigger.set_value("class_name", "pyasm.web.web_init.SidebarTrigger")
        trigger.set_value("mode", "same process,same transaction")
        Trigger.append_static_trigger(trigger, startup=True)

        event = "change|sthpw/schema"
        trigger = SearchType.create("sthpw/trigger")
        trigger.set_value("event", event)
        trigger.set_value("class_name", "pyasm.web.web_init.SidebarTrigger")
        trigger.set_value("mode", "same process,same transaction")
        Trigger.append_static_trigger(trigger, startup=True)

        # when the palette column of the project changes
        event = "change|sthpw/project|palette"
        trigger = SearchType.create("sthpw/trigger")
        trigger.set_value("event", event)
        trigger.set_value("class_name", "pyasm.web.web_init.SidebarTrigger")
        trigger.set_value("mode", "same process,same transaction")
        Trigger.append_static_trigger(trigger, startup=True)


        # when the palette column of the project changes
        event = "change|sthpw/pref_setting"
        trigger = SearchType.create("sthpw/trigger")
        trigger.set_value("event", event)
        trigger.set_value("class_name", "pyasm.web.web_init.SidebarTrigger")
        trigger.set_value("mode", "same process,same transaction")
        Trigger.append_static_trigger(trigger, startup=True)




        
        event = "change|sthpw/login_in_group"
        trigger = SearchType.create("sthpw/trigger")
        trigger.set_value("event", event)
        trigger.set_value("class_name", "pyasm.web.web_init.SidebarTrigger")
        trigger.set_value("mode", "same process,same transaction")
        Trigger.append_static_trigger(trigger, startup=True)


        event = "change|sthpw/login_group"
        trigger = SearchType.create("sthpw/trigger")
        trigger.set_value("event", event)
        trigger.set_value("class_name", "pyasm.web.web_init.SidebarTrigger")
        trigger.set_value("mode", "same process,same transaction")
        
        Trigger.append_static_trigger(trigger, startup=True)



        # FIXME: should this really be a web_init trigger?  This needs
        # to be run even from batch commands
        event = "change|sthpw/task|status"
        trigger = SearchType.create("sthpw/trigger")
        trigger.set_value("event", event)
        trigger.set_value("class_name", "pyasm.web.web_init.StatusLogTrigger")
        trigger.set_value("mode", "same process,same transaction")
        Trigger.append_static_trigger(trigger, startup=True)



        # FIXME: should this be here??
        from pyasm.command.workflow import Workflow
        Workflow().init(startup=True)




        event = "insert|sthpw/login"
        trigger = SearchType.create("sthpw/trigger")
        trigger.set_value("event", event)
        trigger.set_value("class_name", "pyasm.web.web_init.DisplayNameTrigger")
        trigger.set_value("mode", "same process,same transaction")
        Trigger.append_static_trigger(trigger, startup=True)



        #from tactic.command.queue import JobTask
        #JobTask.start()

        from pyasm.biz import Snapshot
        Snapshot.add_integral_trigger()
开发者ID:mincau,项目名称:TACTIC,代码行数:91,代码来源:web_init.py


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