本文整理汇总了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)
示例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()