i18n.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:django-wechat-api 作者: crazy-canux 项目源码 文件源码
def i18n_patterns(prefix, *args):
    """
    Adds the language code prefix to every URL pattern within this
    function. This may only be used in the root URLconf, not in an included
    URLconf.
    """
    if isinstance(prefix, six.string_types):
        warnings.warn(
            "Calling i18n_patterns() with the `prefix` argument and with tuples "
            "instead of django.conf.urls.url() instances is deprecated and "
            "will no longer work in Django 2.0. Use a list of "
            "django.conf.urls.url() instances instead.",
            RemovedInDjango20Warning, stacklevel=2
        )
        pattern_list = patterns(prefix, *args)
    else:
        pattern_list = [prefix] + list(args)
    if not settings.USE_I18N:
        return pattern_list
    return [LocaleRegexURLResolver(pattern_list)]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号