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


Python Resolver.resolve_source_to_url方法代码示例

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


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

示例1: resolve_source_to_url

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

示例2: resolve_source_to_url

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


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