Permalink
Browse files

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
  • Loading branch information...
1 parent 782c1a7 commit 8c54d7cf717cd2c861a87d2c68f90186e53f60a2 @claudep claudep committed Mar 29, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 django/core/management/base.py
View
5 django/core/management/base.py
@@ -247,8 +247,9 @@ def execute(self, *args, **options):
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):
"""

0 comments on commit 8c54d7c

Please sign in to comment.