Fixed #17947 -- Fixed language restore after management command even when exceptions occur. Thanks andrey@kostenko.name for the report and the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17823 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Claude Paroz 2012-03-29 16:33:48 +00:00
parent 782c1a770e
commit 8c54d7cf71
1 changed files with 3 additions and 2 deletions

View File

@ -247,8 +247,9 @@ class BaseCommand(object):
else:
self.stderr.write(smart_str(self.style.ERROR('Error: %s\n' % e)))
sys.exit(1)
if saved_lang is not None:
translation.activate(saved_lang)
finally:
if saved_lang is not None:
translation.activate(saved_lang)
def validate(self, app=None, display_num_errors=False):
"""