當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。