當前位置: 首頁>>代碼示例>>Python>>正文


Python settings.FORMAT_MODULE_PATH屬性代碼示例

本文整理匯總了Python中django.conf.settings.FORMAT_MODULE_PATH屬性的典型用法代碼示例。如果您正苦於以下問題:Python settings.FORMAT_MODULE_PATH屬性的具體用法?Python settings.FORMAT_MODULE_PATH怎麽用?Python settings.FORMAT_MODULE_PATH使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在django.conf.settings的用法示例。


在下文中一共展示了settings.FORMAT_MODULE_PATH屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: iter_format_modules

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import FORMAT_MODULE_PATH [as 別名]
def iter_format_modules(lang, format_module_path=None):
    """Find format modules."""
    if not check_for_language(lang):
        return

    if format_module_path is None:
        format_module_path = settings.FORMAT_MODULE_PATH

    format_locations = []
    if format_module_path:
        if isinstance(format_module_path, str):
            format_module_path = [format_module_path]
        for path in format_module_path:
            format_locations.append(path + '.%s')
    format_locations.append('django.conf.locale.%s')
    locale = to_locale(lang)
    locales = [locale]
    if '_' in locale:
        locales.append(locale.split('_')[0])
    for location in format_locations:
        for loc in locales:
            try:
                yield import_module('%s.formats' % (location % loc))
            except ImportError:
                pass 
開發者ID:reBiocoder,項目名稱:bioforum,代碼行數:27,代碼來源:formats.py

示例2: iter_format_modules

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import FORMAT_MODULE_PATH [as 別名]
def iter_format_modules(lang):
    """
    Does the heavy lifting of finding format modules.
    """
    if check_for_language(lang):
        format_locations = ['django.conf.locale.%s']
        if settings.FORMAT_MODULE_PATH:
            format_locations.append(settings.FORMAT_MODULE_PATH + '.%s')
            format_locations.reverse()
        locale = to_locale(lang)
        locales = [locale]
        if '_' in locale:
            locales.append(locale.split('_')[0])
        for location in format_locations:
            for loc in locales:
                try:
                    yield import_module('.formats', location % loc)
                except ImportError:
                    pass 
開發者ID:blackye,項目名稱:luscan-devel,代碼行數:21,代碼來源:formats.py

示例3: iter_format_modules

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import FORMAT_MODULE_PATH [as 別名]
def iter_format_modules(lang, format_module_path=None):
    """
    Does the heavy lifting of finding format modules.
    """
    if not check_for_language(lang):
        return

    if format_module_path is None:
        format_module_path = settings.FORMAT_MODULE_PATH

    format_locations = []
    if format_module_path:
        if isinstance(format_module_path, six.string_types):
            format_module_path = [format_module_path]
        for path in format_module_path:
            format_locations.append(path + '.%s')
    format_locations.append('django.conf.locale.%s')
    locale = to_locale(lang)
    locales = [locale]
    if '_' in locale:
        locales.append(locale.split('_')[0])
    for location in format_locations:
        for loc in locales:
            try:
                yield import_module('%s.formats' % (location % loc))
            except ImportError:
                pass 
開發者ID:lanbing510,項目名稱:GTDWeb,代碼行數:29,代碼來源:formats.py

示例4: get_format_modules

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import FORMAT_MODULE_PATH [as 別名]
def get_format_modules(lang=None, reverse=False):
    """
    Returns a list of the format modules found
    """
    if lang is None:
        lang = get_language()
    modules = _format_modules_cache.setdefault(lang, list(iter_format_modules(lang, settings.FORMAT_MODULE_PATH)))
    if reverse:
        return list(reversed(modules))
    return modules 
開發者ID:lanbing510,項目名稱:GTDWeb,代碼行數:12,代碼來源:formats.py

示例5: get_format_modules

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import FORMAT_MODULE_PATH [as 別名]
def get_format_modules(lang=None, reverse=False):
    """Return a list of the format modules found."""
    if lang is None:
        lang = get_language()
    if lang not in _format_modules_cache:
        _format_modules_cache[lang] = list(iter_format_modules(lang, settings.FORMAT_MODULE_PATH))
    modules = _format_modules_cache[lang]
    if reverse:
        return list(reversed(modules))
    return modules 
開發者ID:reBiocoder,項目名稱:bioforum,代碼行數:12,代碼來源:formats.py

示例6: get_format_modules

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import FORMAT_MODULE_PATH [as 別名]
def get_format_modules(lang=None, reverse=False):
    """
    Returns a list of the format modules found
    """
    if lang is None:
        lang = get_language()
    if lang not in _format_modules_cache:
        _format_modules_cache[lang] = list(iter_format_modules(lang, settings.FORMAT_MODULE_PATH))
    modules = _format_modules_cache[lang]
    if reverse:
        return list(reversed(modules))
    return modules 
開發者ID:Yeah-Kun,項目名稱:python,代碼行數:14,代碼來源:formats.py


注:本文中的django.conf.settings.FORMAT_MODULE_PATH屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。