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)
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)
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)
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)