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


Python InputFilter.filter_unique_list方法代码示例

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


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

示例1: get_sort_capabilities

# 需要导入模块: from dNG.data.text.input_filter import InputFilter [as 别名]
# 或者: from dNG.data.text.input_filter.InputFilter import filter_unique_list [as 别名]
    def get_sort_capabilities(self):
        """
Returns the UPnP sort capabilities.

:return: (str) UPnP sort capabilities
:since:  v0.2.00
        """

        didl_fields = Hook.call("dNG.pas.upnp.Resource.getSortableDidlFields", client_user_agent = self.client_user_agent)
        if (type(didl_fields) != list or len(didl_fields) < 1): didl_fields = None

        if (didl_fields is None): _return = ""
        else: _return = ",".join(InputFilter.filter_unique_list(didl_fields))

        return _return
开发者ID:dNG-git,项目名称:pas_upnp,代码行数:17,代码来源:root_container.py

示例2: render

# 需要导入模块: from dNG.data.text.input_filter import InputFilter [as 别名]
# 或者: from dNG.data.text.input_filter.InputFilter import filter_unique_list [as 别名]

#.........这里部分代码省略.........

        theme = self.theme
        theme_path = theme.replace(".", path.sep)

        theme_subtype = self.theme_subtype

        file_path_name = path.join(self.path, theme_path, "{0}.tsc".format(theme_subtype))

        if (theme_subtype != "site" and (not os.access(file_path_name, os.R_OK))):
            file_path_name = path.join(self.path, theme_path, "site.tsc")
        #

        theme_data = (None if (self.cache_instance is None) else self.cache_instance.get_file(file_path_name))

        if (theme_data is None):
            file_obj = File()
            if (not file_obj.open(file_path_name, True, "r")): raise IOException("Failed to open theme file for '{0}'".format(theme))

            theme_data = file_obj.read()
            file_obj.close()

            if (theme_data is None): raise IOException("Failed to read theme file for '{0}'".format(theme))
            if (self.cache_instance is not None): self.cache_instance.set_file(file_path_name, theme_data)
        #

        """
Read corresponding theme configuration
        """

        file_path_name = file_path_name[:-3] + "json"
        Settings.read_file(file_path_name)

        self.content = { "canonical_url": self.canonical_url,
                         "page_description": self.description,
                         "page_title": self.title,
                         "page_content": content
                       }

        css_files = (self.css_files.copy() if (hasattr(self.css_files, "copy")) else copy(self.css_files))
        js_files = (self.js_files.copy() if (hasattr(self.js_files, "copy")) else copy(self.js_files))
        webc_files = (self.webc_files.copy() if (hasattr(self.webc_files, "copy")) else copy(self.webc_files))

        theme_settings = self.settings

        if (theme_settings is not None):
            if ("css_files" in theme_settings): css_files += theme_settings['css_files']
            if ("js_files" in theme_settings): js_files += theme_settings['js_files']
            if ("webc_files" in theme_settings): webc_files += theme_settings['webc_files']

            if ("l10n_inits" in theme_settings):
                for file_basename in theme_settings['l10n_inits']: L10n.init(file_basename)
            #

            app_entry_point = Hook.call("dNG.pas.http.App.getBrowserEntryPointUrl",
                                        renderer = self,
                                        theme_subtype_settings = theme_settings
                                       )

            app_cache_manifest_url = Hook.call("dNG.pas.http.App.getBrowserCacheManifestUrl",
                                               renderer = self,
                                               theme_subtype_settings = theme_settings,
                                               entry_point = app_entry_point
                                              )

            app_web_manifest_url = Hook.call("dNG.pas.http.App.getBrowserWebManifestUrl",
                                             renderer = self,
                                             theme_subtype_settings = theme_settings,
                                             entry_point = app_entry_point
                                            )

            if (app_entry_point is not None):
                self.content['app_entry_point'] = app_entry_point

                if (app_cache_manifest_url is None):
                    app_cache_manifest_url = Link().build_url(Link.TYPE_VIRTUAL_PATH,
                                                              { "__virtual__": "/app/cache.manifest" }
                                                             )
                #

                if (app_web_manifest_url is None):
                    app_web_manifest_url = Link().build_url(Link.TYPE_VIRTUAL_PATH,
                                                            { "__virtual__": "/app/web.manifest" }
                                                           )
                #
            #

            if (app_cache_manifest_url is not None): self.content['app_cache_manifest'] = app_cache_manifest_url
            if (app_web_manifest_url is not None): self.content['app_web_manifest'] = app_web_manifest_url
        #

        css_files = InputFilter.filter_unique_list(css_files)
        if (len(css_files) > 0): self.content['css_files'] = css_files

        js_files = InputFilter.filter_unique_list(js_files)
        if (len(js_files) > 0): self.content['js_files'] = js_files

        webc_files = InputFilter.filter_unique_list(webc_files)
        if (len(webc_files) > 0): self.content['webc_files'] = webc_files

        return self._parse(theme_data)
开发者ID:dNG-git,项目名称:pas_http_core,代码行数:104,代码来源:renderer.py


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