本文整理匯總了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')]
)