本文整理汇总了Python中pyasm.common.Common.run_mako方法的典型用法代码示例。如果您正苦于以下问题:Python Common.run_mako方法的具体用法?Python Common.run_mako怎么用?Python Common.run_mako使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.common.Common
的用法示例。
在下文中一共展示了Common.run_mako方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_config
# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import run_mako [as 别名]
def get_config(self):
self.view = self.kwargs.get("search_view")
config = self.kwargs.get("search_config")
if not self.view:
self.view = 'custom_filter'
#view = "custom_filter"
project_code = Project.extract_project_code(self.search_type)
search = Search("config/widget_config", project_code=project_code )
search.add_filter("view", self.view)
search.add_filter("search_type", self.base_search_type)
config_sobjs = search.get_sobjects()
from pyasm.search import WidgetDbConfig
config_sobj = WidgetDbConfig.merge_configs(config_sobjs)
if config_sobj:
#config_xml = config_sobj.get("config")
config_xml = config_sobj.get_xml().to_string()
config_xml = config_xml.replace("<", "<")
config_xml = config_xml.replace(">", ">")
config_xml = Common.run_mako(config_xml)
elif config:
config_xml = '''
<config>
<custom_filter>%s
</custom_filter>
</config>
''' % config
else:
config_xml = '''
<config>
<custom_filter>
</custom_filter>
</config>
'''
# use the one defined in the default config file
file_configs = WidgetConfigView.get_configs_from_file(self.base_search_type, self.view)
if file_configs:
config = file_configs[0]
xml_node = config.get_view_node()
if xml_node is not None:
xml = Xml(config.get_xml().to_string())
config_xml = '<config>%s</config>' %xml.to_string(node=xml_node)
from pyasm.widget import WidgetConfig
config = WidgetConfig.get(view=self.view, xml=config_xml)
return config