Fixed #24073 -- Returned None for get_language when translations are deactivated

This fixes a regression caused by f7c287fca9. Thanks Markus Holtermann
for identifying the regression.
This commit is contained in:
Claude Paroz 2015-01-08 11:11:35 +01:00
parent d6c8121ed0
commit 543df07720
5 changed files with 19 additions and 8 deletions

View file

@ -2,7 +2,6 @@ import os
from django.apps import apps
from django.db import connection
from django.conf import settings
from django.core import management
from django.core.management import BaseCommand, CommandError, find_commands
from django.core.management.utils import find_command, popen_wrapper
@ -48,13 +47,12 @@ class CommandTests(SimpleTestCase):
management.ManagementUtility(['manage.py', 'dance', '--example=raise']).execute()
self.assertIn("CommandError", stderr.getvalue())
def test_default_en_us_locale_set(self):
# Forces en_us when set to true
def test_deactivate_locale_set(self):
# Deactivate translation when set to true
out = StringIO()
with translation.override('pl'):
management.call_command('leave_locale_alone_false', stdout=out)
# get_language returns settings.LANGUAGE_CODE for NullTranslations instances
self.assertEqual(out.getvalue(), "%s\n" % settings.LANGUAGE_CODE)
self.assertEqual(out.getvalue(), "")
def test_configured_locale_preserved(self):
# Leaves locale from settings when set to false