1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #19730 -- Don't validate importability of settings by using i18n in management commands.

They are handled independently now and the latter can be influenced by
the new BaseCommand.leave_locale_alone internal option.

Thanks chrischambers for the report, Claude, lpiatek, neaf and gabooo for
their work on a patch, originally on refs. #17379.
This commit is contained in:
Ramiro Morales
2013-02-03 20:53:48 -03:00
parent 2c173ff3b4
commit 869c9ba306
10 changed files with 153 additions and 46 deletions

View File

@@ -44,3 +44,17 @@ class CommandTests(TestCase):
finally:
sys.stderr = old_stderr
self.assertIn("CommandError", err.getvalue())
def test_default_en_us_locale_set(self):
# Forces en_us when set to true
out = StringIO()
with translation.override('pl'):
management.call_command('leave_locale_alone_false', stdout=out)
self.assertEqual(out.getvalue(), "en-us\n")
def test_configured_locale_preserved(self):
# Leaves locale from settings when set to false
out = StringIO()
with translation.override('pl'):
management.call_command('leave_locale_alone_true', stdout=out)
self.assertEqual(out.getvalue(), "pl\n")