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


Python WidgetConfigView.get_configs_from_file方法代码示例

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


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

示例1: get_config

# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_configs_from_file [as 别名]
    def get_config(my):
        # TEST
        config_xml = '''
        <config>
        <custom_filter>
          <element name='asset_library'>
            <display class='SelectWdg'>
                <query>prod/asset_library|code|code</query>
                <empty>true</empty>
            </display>
          </element>
          <element name='pipeline_code'>
            <display class='SelectWdg'>
                <query>sthpw/pipeline|code|code</query>
                <empty>true</empty>
            </display>
          </element>
        </custom_filter>
        </config>
        '''

        my.view = my.kwargs.get("search_view")
        if not my.view:
            my.view = 'custom_filter'
        #view = "custom_filter"
        project_code = Project.extract_project_code(my.search_type)
        search = Search("config/widget_config", project_code=project_code )
        search.add_filter("view", my.view)
        
       
        search.add_filter("search_type", my.base_search_type)
        config_sobj = search.get_sobject()
        if config_sobj:
            config_xml = config_sobj.get_value("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(my.base_search_type, my.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=my.view, xml=config_xml)

        return config
开发者ID:funic,项目名称:TACTIC,代码行数:60,代码来源:simple_search_wdg.py

示例2: get_config

# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_configs_from_file [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("&lt;", "<")
            config_xml = config_xml.replace("&gt;", ">")
            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
开发者ID:mincau,项目名称:TACTIC,代码行数:57,代码来源:simple_search_wdg.py

示例3: get_config

# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_configs_from_file [as 别名]
    def get_config(my):
        # look in the db first
        configs = []
        config = WidgetDbConfig.get_by_search_type(my.search_type, my.view)
        get_edit_def = False
        if config:
            configs.append(config)
            get_edit_def = True
            config = WidgetDbConfig.get_by_search_type(my.search_type, "edit_definition")
            if config:
                configs.append(config)

        #if my.mode == 'insert':
        #    config = WidgetDbConfig.get_by_search_type(my.search_type, "insert")
        #    if config:
        #        configs.append(config)
        # look for a definition
        #config = WidgetDbConfig.get_by_search_type(my.search_type, "edit")
        #if config:
        #    configs.append(config)

        file_configs = WidgetConfigView.get_configs_from_file(my.search_type, my.view)
        configs.extend(file_configs)

        file_configs = WidgetConfigView.get_configs_from_file(my.search_type, "edit")
        configs.extend(file_configs)

        #TODO: add edit_definition    
        #file_configs = WidgetConfigView.get_configs_from_file(my.search_type, "edit_definition")
        #configs.extend(file_configs)
        if not get_edit_def:
            config = WidgetDbConfig.get_by_search_type(my.search_type, "edit_definition")
            if config:
                configs.append(config)
    
        config = WidgetConfigView(my.search_type, my.view, configs)
        return config
开发者ID:funic,项目名称:TACTIC,代码行数:39,代码来源:edit_wdg.py


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