本文整理汇总了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))
示例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))
示例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))
示例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')]
)