コード例 #1
0
def locale_redirect(pattern, to, prepend_locale=True, **kwargs):
    """
    Return a locale url matcher suited for urlpatterns

    This is suited for matching URLs that may start with a locale, like:

    /en-US/docs/Foo/Bar

    If the locale is a valid locale, the pattern matches against the remaining
    path:

    locale=/en-US, path=/docs/Foo/Bar

    However, many prefix strings match, so watch out for unintended matches:

    /docs/Foo/Bar

    can be matched as:

    locale=/docs, path=Foo/Bar
    """
    return lib_redirect(pattern,
                        to,
                        locale_prefix=True,
                        prepend_locale=prepend_locale,
                        **kwargs)
コード例 #2
0
ファイル: redirects.py プロジェクト: saranshgupta1995/kuma
def redirect(pattern, to, **kwargs):
    """
    Return a url matcher suited for urlpatterns

    Changes the defaults for locale_prefix and prepend_locale in the
    redirect_urls library.
    """
    return lib_redirect(pattern, to, locale_prefix=False,
                        prepend_locale=False, **kwargs)
コード例 #3
0
ファイル: redirects.py プロジェクト: Elchi3/kuma
def redirect(pattern, to, **kwargs):
    """
    Return a url matcher suited for urlpatterns

    Changes the defaults for locale_prefix and prepend_locale in the
    redirect_urls library.
    """
    return lib_redirect(pattern, to, locale_prefix=False,
                        prepend_locale=False, **kwargs)
コード例 #4
0
ファイル: redirects.py プロジェクト: Elchi3/kuma
def locale_redirect(pattern, to, prepend_locale=True, **kwargs):
    """
    Return a locale url matcher suited for urlpatterns

    This is suited for matching URLs that may start with a locale, like:

    /en-US/docs/Foo/Bar

    If the locale is a valid locale, the pattern matches against the remaining
    path:

    locale=/en-US, path=/docs/Foo/Bar

    However, many prefix strings match, so watch out for unintended matches:

    /docs/Foo/Bar

    can be matched as:

    locale=/docs, path=Foo/Bar
    """
    return lib_redirect(pattern, to, locale_prefix=True,
                        prepend_locale=prepend_locale, **kwargs)