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


Python finders.searched_locations方法代码示例

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


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

示例1: handle_label

# 需要导入模块: from django.contrib.staticfiles import finders [as 别名]
# 或者: from django.contrib.staticfiles.finders import searched_locations [as 别名]
def handle_label(self, path, **options):
        verbosity = options['verbosity']
        result = finders.find(path, all=options['all'])
        path = force_text(path)
        if verbosity >= 2:
            searched_locations = ("Looking in the following locations:\n  %s" %
                                  "\n  ".join(force_text(location)
                                  for location in finders.searched_locations))
        else:
            searched_locations = ''
        if result:
            if not isinstance(result, (list, tuple)):
                result = [result]
            result = (force_text(os.path.realpath(path)) for path in result)
            if verbosity >= 1:
                file_list = '\n  '.join(result)
                return ("Found '%s' here:\n  %s\n%s" %
                        (path, file_list, searched_locations))
            else:
                return '\n'.join(result)
        else:
            message = ["No matching file found for '%s'." % path]
            if verbosity >= 2:
                message.append(searched_locations)
            if verbosity >= 1:
                self.stderr.write('\n'.join(message)) 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:28,代码来源:findstatic.py

示例2: handle_label

# 需要导入模块: from django.contrib.staticfiles import finders [as 别名]
# 或者: from django.contrib.staticfiles.finders import searched_locations [as 别名]
def handle_label(self, path, **options):
        verbosity = options['verbosity']
        result = finders.find(path, all=options['all'])
        if verbosity >= 2:
            searched_locations = (
                "\nLooking in the following locations:\n  %s" %
                "\n  ".join(finders.searched_locations)
            )
        else:
            searched_locations = ''
        if result:
            if not isinstance(result, (list, tuple)):
                result = [result]
            result = (os.path.realpath(path) for path in result)
            if verbosity >= 1:
                file_list = '\n  '.join(result)
                return ("Found '%s' here:\n  %s%s" %
                        (path, file_list, searched_locations))
            else:
                return '\n'.join(result)
        else:
            message = ["No matching file found for '%s'." % path]
            if verbosity >= 2:
                message.append(searched_locations)
            if verbosity >= 1:
                self.stderr.write('\n'.join(message)) 
开发者ID:reBiocoder,项目名称:bioforum,代码行数:28,代码来源:findstatic.py

示例3: handle_label

# 需要导入模块: from django.contrib.staticfiles import finders [as 别名]
# 或者: from django.contrib.staticfiles.finders import searched_locations [as 别名]
def handle_label(self, path, **options):
        verbosity = options['verbosity']
        result = finders.find(path, all=options['all'])
        path = force_text(path)
        if verbosity >= 2:
            searched_locations = (
                "\nLooking in the following locations:\n  %s" %
                "\n  ".join(force_text(location) for location in finders.searched_locations)
            )
        else:
            searched_locations = ''
        if result:
            if not isinstance(result, (list, tuple)):
                result = [result]
            result = (force_text(os.path.realpath(path)) for path in result)
            if verbosity >= 1:
                file_list = '\n  '.join(result)
                return ("Found '%s' here:\n  %s%s" %
                        (path, file_list, searched_locations))
            else:
                return '\n'.join(result)
        else:
            message = ["No matching file found for '%s'." % path]
            if verbosity >= 2:
                message.append(searched_locations)
            if verbosity >= 1:
                self.stderr.write('\n'.join(message)) 
开发者ID:bpgc-cte,项目名称:python2017,代码行数:29,代码来源:findstatic.py

示例4: test_searched_locations

# 需要导入模块: from django.contrib.staticfiles import finders [as 别名]
# 或者: from django.contrib.staticfiles.finders import searched_locations [as 别名]
def test_searched_locations(self):
        finders.find('spam')
        self.assertEqual(
            finders.searched_locations,
            [os.path.join(TEST_ROOT, 'project', 'documents')]
        ) 
开发者ID:nesdis,项目名称:djongo,代码行数:8,代码来源:test_finders.py


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