- def process_request(self, request):
- language = translation.get_language_from_path(request.path_info)
- if language == settings.LANGUAGE_CODE:
- raise Http404
- if language:
- translation.activate(language)
- request.LANGUAGE_CODE = translation.get_language()
+ class URLLocaleMiddleware(LocaleMiddleware):
+ def __init__(self, *args, **kwargs):
+ warnings.warn(
+ "As of Django 1.10, fnpdjango.middleware.URLLocaleMiddleware "
+ "is deprecated in favor of "
+ "django.middleware.locale.LocaleMiddleware.",
+ DeprecationWarning)
+ super(URLLocaleMiddleware, self).__init__(*args, **kwargs)