• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python env.Resolver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中webassets.env.Resolver的典型用法代码示例。如果您正苦于以下问题:Python Resolver类的具体用法?Python Resolver怎么用?Python Resolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: resolve_output_to_url

    def resolve_output_to_url(self, target):
        # With a directory/url pair set, use it for output files.
        if self.use_webassets_system_for_output:
            return Resolver.resolve_output_to_url(self, target)

        # Otherwise, behaves like generating urls to a source file.
        return self.resolve_source_to_url(None, target)
开发者ID:50onRed,项目名称:flask-assets,代码行数:7,代码来源:flask_assets.py


示例2: resolve_output_to_url

    def resolve_output_to_url(self, ctx, target):
        # With a directory/url pair set, use it for output files.
        if self.use_webassets_system_for_output(ctx):
            return Resolver.resolve_output_to_url(self, ctx, target)

        # Otherwise, behaves like all other flask URLs.
        return self.convert_item_to_flask_url(ctx, target)
开发者ID:Mondego,项目名称:pyreco,代码行数:7,代码来源:allPythonContent.py


示例3: resolve_output_to_path

    def resolve_output_to_path(self, ctx, target, bundle):
        # If a directory/url pair is set, always use it for output files
        if self.use_webassets_system_for_output(ctx):
            return Resolver.resolve_output_to_path(self, ctx, target, bundle)

        # Allow targeting blueprint static folders
        directory, rel_path, endpoint = self.split_prefix(ctx, target)
        return path.normpath(path.join(directory, rel_path))
开发者ID:Mondego,项目名称:pyreco,代码行数:8,代码来源:allPythonContent.py


示例4: resolve_source_to_url

    def resolve_source_to_url(self, filepath, item):
        if not self.use_staticfiles:
            return Resolver.resolve_source_to_url(self, filepath, item)

        # With staticfiles enabled, searching the url mappings, as the
        # parent implementation does, will not help. Instead, we can
        # assume that the url is the root url + the original relative
        # item that was specified (and searched for using the finders).
        return url_prefix_join(self.env.url, item)
开发者ID:alepane21,项目名称:django-assets,代码行数:9,代码来源:env.py


示例5: search_for_source

    def search_for_source(self, ctx, item):
        if not self.use_staticfiles:
            return Resolver.search_for_source(self, ctx, item)

        if has_magic(item):
            return list(self.glob_staticfiles(item))
        else:
            f = finders.find(item)
            if f is not None:
                return f

        raise IOError(
            "'%s' not found (using staticfiles finders)" % item)
开发者ID:miracle2k,项目名称:django-assets,代码行数:13,代码来源:env.py


示例6: search_for_source

 def search_for_source(self, item):
     if self.env.load_path:
         # Note: With only env.directory set, we don't go to default;
         # Setting env.directory only makes the output directory fixed.
         return Resolver.search_for_source(self, item)
     # Look in correct blueprint's directory
     directory, item = self.split_prefix(item)
     try:
         return self.consider_single_directory(directory, item)
     except IOError:
         # XXX: Hack to make the tests pass, which are written to not
         # expect an IOError upon missing files. They need to be rewritten.
         return path.normpath(path.join(directory, item))
开发者ID:atefzed,项目名称:flask-assets,代码行数:13,代码来源:flask_assets.py


示例7: resolve_source_to_url

    def resolve_source_to_url(self, filepath, item):
        if not self.use_staticfiles:
            return Resolver.resolve_source_to_url(self, filepath, item)

        # With staticfiles enabled, searching the url mappings, as the
        # parent implementation does, will not help. Instead, we can
        # assume that the url is the root url + the original relative
        # item that was specified (and searched for using the finders).
        # The only exception is when the relative url contains a wildcard.
        # In that case we need to extract from the filepath the right part
        # of the path and then join it with the root url.
        if '*' in item:
            path, _ = item.rsplit('*', 1)
            item = '%s%s' % (path, filepath.rsplit(path, 1)[1])
        return url_prefix_join(self.env.url, item)
开发者ID:jorgebastida,项目名称:django-assets,代码行数:15,代码来源:env.py


示例8: search_for_source

    def search_for_source(self, ctx, item):
        # If a load_path is set, use it instead of the Flask static system.
        #
        # Note: With only env.directory set, we don't go to default;
        # Setting env.directory only makes the output directory fixed.
        if self.use_webassets_system_for_sources(ctx):
            return Resolver.search_for_source(self, ctx, item)

        # Look in correct blueprint's directory
        directory, item, endpoint = self.split_prefix(ctx, item)
        try:
            return self.consider_single_directory(directory, item)
        except IOError:
            # XXX: Hack to make the tests pass, which are written to not
            # expect an IOError upon missing files. They need to be rewritten.
            return path.normpath(path.join(directory, item))
开发者ID:Mondego,项目名称:pyreco,代码行数:16,代码来源:allPythonContent.py


示例9: search_for_source

    def search_for_source(self, ctx, item):
        if not self.use_staticfiles:
            return Resolver.search_for_source(self, ctx, item)

        # We can't import too early because of unit tests
        try:
            from django.contrib.staticfiles import finders
        except ImportError:
            # Support pre-1.3 versions.
            finders = None
    
        # Use the staticfiles finders to determine the absolute path
        if finders:
            if has_magic(item):
                return list(self.glob_staticfiles(item))
            else:
                f = finders.find(item)
                if f is not None:
                    return f

        raise IOError(
            "'%s' not found (using staticfiles finders)" % item)
开发者ID:YPlan,项目名称:django-assets,代码行数:22,代码来源:env.py


示例10: resolve_output_to_path

 def resolve_output_to_path(self, target, bundle):
     if self.env.config.get('directory'):
         return Resolver.resolve_output_to_path(self, target, bundle)
     # Allow targeting blueprint static folders
     directory, rel_path = self.split_prefix(target)
     return path.normpath(path.join(directory, rel_path))
开发者ID:atefzed,项目名称:flask-assets,代码行数:6,代码来源:flask_assets.py


示例11: __init__

 def __init__(self, env):
     Resolver.__init__(self, env)
     self.resolver = AssetResolver(None)
开发者ID:rclmenezes,项目名称:pyramid_webassets,代码行数:3,代码来源:__init__.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python filter.get_filter函数代码示例发布时间:2022-05-26
下一篇:
Python bundle.get_all_bundle_files函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap