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


Python Resolver.search_for_source方法代码示例

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


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

示例1: search_for_source

# 需要导入模块: from webassets.env import Resolver [as 别名]
# 或者: from webassets.env.Resolver import search_for_source [as 别名]
 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,代码行数:15,代码来源:flask_assets.py

示例2: search_for_source

# 需要导入模块: from webassets.env import Resolver [as 别名]
# 或者: from webassets.env.Resolver import search_for_source [as 别名]
    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,代码行数:15,代码来源:env.py

示例3: search_for_source

# 需要导入模块: from webassets.env import Resolver [as 别名]
# 或者: from webassets.env.Resolver import search_for_source [as 别名]
    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,代码行数:18,代码来源:allPythonContent.py

示例4: search_for_source

# 需要导入模块: from webassets.env import Resolver [as 别名]
# 或者: from webassets.env.Resolver import search_for_source [as 别名]
    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,代码行数:24,代码来源:env.py


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