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


Python SearchType.get_schema_config方法代码示例

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


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

示例1: init

# 需要导入模块: from pyasm.search import SearchType [as 别名]
# 或者: from pyasm.search.SearchType import get_schema_config [as 别名]
    def init(my):
        """initialize the widget_config, and from there retrieve the schema_config"""
        web = WebContainer.get_web()
        my.search_type = my.kwargs.get("search_type")

        element_name = my.kwargs.get("element_name")
        my.view = my.kwargs.get("view")

        # FIXME: comment out the assert for now to avoid error screen
        if not my.view:
            my.view = "table"
        # assert my.view

        my.config_xml = my.kwargs.get("config_xml")
        if not my.config_xml:
            my.config_xml = web.get_form_value("config_xml")

        my.default = my.kwargs.get("default") == "True"

        cbk = ManageSearchTypeDetailCbk(search_type=my.search_type, view=my.view, element_name=element_name)
        Command.execute_cmd(cbk)

        my.config_string = ""
        my.data_type_string = ""
        my.name_string = ""
        my.title_string = ""
        my.nullable_string = ""
        my.has_column = True

        if element_name:
            if my.config_xml:
                my.config_string = my.config_xml
                whole_config_string = "<config><%s>%s</%s></config>" % (my.view, my.config_xml, my.view)
                config = WidgetConfig.get(xml=whole_config_string, view=my.view)
                my.config = WidgetConfigView(my.search_type, my.view, [config])
            else:
                # don't pass in default here
                my.config = my.get_config(my.search_type, my.view)
                node = my.config.get_element_node(element_name)
                if node is not None:
                    config_xml = my.config.get_xml()

                    my.config_string = config_xml.to_string(node)
                    my.title_string = config_xml.get_attribute(node, "title")
            schema_config = SearchType.get_schema_config(my.search_type)

            attributes = schema_config.get_element_attributes(element_name)
            my.data_type_string = attributes.get("data_type")

            # double_precision is float
            if my.data_type_string == "double precision":
                my.data_type_string = "float"

            my.name_string = attributes.get("name")
            my.nullable_string = attributes.get("nullable")
            my.is_new_column = attributes.get("new") == "True"

            # a database columnless widget
            if not my.name_string:
                my.has_column = False
开发者ID:pombredanne,项目名称:TACTIC,代码行数:62,代码来源:search_type_manager_wdg.py

示例2: init

# 需要导入模块: from pyasm.search import SearchType [as 别名]
# 或者: from pyasm.search.SearchType import get_schema_config [as 别名]
    def init(self):
        '''initialize the widget_config, and from there retrieve the schema_config'''
        web = WebContainer.get_web()
        self.search_type = self.kwargs.get('search_type')
        
        element_name = self.kwargs.get('element_name')
        self.view = self.kwargs.get('view')
        
        # FIXME: comment out the assert for now to avoid error screen
        if not self.view:
            self.view = 'table'
        #assert self.view

        self.config_xml = self.kwargs.get('config_xml')
        if not self.config_xml:
            self.config_xml = web.get_form_value('config_xml')
        
        self.default = self.kwargs.get('default') == 'True'

        cbk = ManageSearchTypeDetailCbk(search_type=self.search_type, view=self.view, \
                element_name=element_name)
        Command.execute_cmd(cbk)

        self.config_string = ""
        self.data_type_string = ""
        self.name_string = ""
        self.title_string = ""
        self.nullable_string = ""
        self.has_column = True


       
        if element_name:
            if self.config_xml:
                self.config_string = self.config_xml
                whole_config_string = "<config><%s>%s</%s></config>"%(self.view, self.config_xml, self.view)
                config = WidgetConfig.get(xml=whole_config_string, view=self.view)
                self.config = WidgetConfigView(self.search_type, self.view, [config])
            else:
                # don't pass in default here
                self.config = self.get_config(self.search_type, self.view)
                node = self.config.get_element_node(element_name)
                if node is not None:
                    config_xml = self.config.get_xml()
                    

                    self.config_string = config_xml.to_string(node)
                    self.title_string = config_xml.get_attribute(node, 'title')
            schema_config = SearchType.get_schema_config(self.search_type)
            
            attributes = schema_config.get_element_attributes(element_name)
            self.data_type_string = attributes.get("data_type")
            
            # double_precision is float
            if self.data_type_string == 'double precision':
                self.data_type_string = 'float'

            self.name_string = attributes.get("name")
            self.nullable_string = attributes.get("nullable")
            self.is_new_column = attributes.get("new") == 'True'

            # a database columnless widget
            if not self.name_string:
                self.has_column = False
开发者ID:mincau,项目名称:TACTIC,代码行数:66,代码来源:search_type_manager_wdg.py

示例3: get_config

# 需要导入模块: from pyasm.search import SearchType [as 别名]
# 或者: from pyasm.search.SearchType import get_schema_config [as 别名]
    def get_config(cls, search_type, view, default=None, personal=False):
        # personal doesn't mean much here since this is only for Project view definition
        """
        if view == "__column__":
            xml == '''
            <config>
                <element name="tttt" type="__database__"/>
                <element name="uuuu" type="__database__"/>
                <element name="vvvv" type="__database__"/>
            </config>
            '''
        """
        widget_config = None
        config_view = None
        widget_config_list = []


        # get all the configs relevant to this search_type
        configs = []
       
        from pyasm.widget import WidgetConfigView
        if view == "definition":
            if default:
                try:
                    default_config_view = WidgetConfigView.get_by_search_type(search_type, view, use_cache=False, local_search=True)

                    user_config_view = WidgetConfigView.get_by_search_type(search_type, view)
                  
                    #merge the user config view from db into the default config view in xml file
                    default_config = default_config_view.get_definition_config()
                    user_config = user_config_view.get_definition_config()
                    if user_config:
                        user_element_names = user_config.get_element_names()
                        # make sure it's unique, there is a new validate function for
                        # WidgetDbConfig to ensure that also
                        user_element_names = Common.get_unique_list(user_element_names)
                        for elem in user_element_names:
                            user_node = user_config.get_element_node(elem)
                            default_config.append_xml_element(elem, node=user_node)
                except SqlException as e:
                     print "Search ERROR: ", e.__str__()
                     default_config = None
                
                if default_config:
                    default_config.get_xml().clear_xpath_cache()
                    widget_config_list = [default_config]

            else:
                config_view = WidgetConfigView.get_by_search_type(search_type, view, use_cache=True)

        elif view == "database_definition":
            schema_config = SearchType.get_schema_config(search_type)
            widget_config_list = [schema_config]
        elif view == 'template':
            base_dir = Environment.get_install_dir()
            file_path="%s/src/config2/search_type/search/DEFAULT-conf.xml" % base_dir
            if os.path.exists(file_path):
                widget_config = WidgetConfig.get(file_path=file_path, view=view)
                widget_config_list = [widget_config]
            '''
            elif default == True :
                base_dir = Environment.get_install_dir()
                file_path="%s/src/config2/search_type/search/DEFAULT-conf.xml" % base_dir
                if os.path.exists(file_path):
                    widget_config = WidgetConfig.get(file_path=file_path, view="default_definition")
                    widget_config_list = [widget_config]
            '''
        elif view == "custom_definition":
            # look for a definition in the database
            search = Search("config/widget_config")
            search.add_filter("search_type", 'SearchTypeSchema')
            search.add_filter("view", view)
            config = search.get_sobject()
            # this is really just a custom made definition
            #view = "definition"
            
            if config:
                widget_config_list = [config]
            else:
                widget_config_list = []

        elif view == "db_column":
            # look for a definition in the database
            """
            view = "definition"
            from pyasm.search import SObjectDefaultConfig
            default = SObjectDefaultConfig(search_type=search_type,view=view)
            xml = default.get_xml()
            config = WidgetConfig.get(view=view, xml=xml)
            widget_config_list = [config]
            """
            try:   
                # add the schema config definiiton
                schema_config = SearchType.get_schema_config(search_type)
                widget_config_list = [schema_config]
            except SqlException as e:
                widget_config_list = []
        if not config_view:
            config_view = WidgetConfigView(search_type, view, widget_config_list)
        return config_view
开发者ID:mincau,项目名称:TACTIC,代码行数:102,代码来源:search_type_manager_wdg.py

示例4: SObjectDefaultConfig

# 需要导入模块: from pyasm.search import SearchType [as 别名]
# 或者: from pyasm.search.SearchType import get_schema_config [as 别名]
            else:
                widget_config_list = []

        elif view == "db_column":
            # look for a definition in the database
            """
            view = "definition"
            from pyasm.search import SObjectDefaultConfig
            default = SObjectDefaultConfig(search_type=search_type,view=view)
            xml = default.get_xml()
            config = WidgetConfig.get(view=view, xml=xml)
            widget_config_list = [config]
            """
            try:
                # add the schema config definiiton
                schema_config = SearchType.get_schema_config(search_type)
                widget_config_list = [schema_config]
            except SqlException, e:
                widget_config_list = []
        if not config_view:
            config_view = WidgetConfigView(search_type, view, widget_config_list)
        return config_view

    get_config = classmethod(get_config)

    def add_link_behavior(my, link_wdg, element_name, config, options):
        """this method provides the changed to add behaviors to a link"""

        # check security
        # default_access = "view"
        # security = Environment.get_security()
开发者ID:pombredanne,项目名称:TACTIC,代码行数:33,代码来源:search_type_manager_wdg.py


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