summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJulien Phalip <jphalip@gmail.com>2011-12-21 15:35:58 +0000
committerJulien Phalip <jphalip@gmail.com>2011-12-21 15:35:58 +0000
commit45e3dff5ac697f16829697bc2a899eaeac8986ea (patch)
tree4ec581efd5e97756f6162a0de04a74a3950ac7ce /django
parent39109b0e44c77d0acf1c48c9f48e3631eff5f122 (diff)
Ensured that `makemessages` doesn't leave any temporary file over if the parsing of a template file fails. Refs #8536.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17240 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/core/management/commands/makemessages.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py
index a903c3c211..e31c6c8d31 100644
--- a/django/core/management/commands/makemessages.py
+++ b/django/core/management/commands/makemessages.py
@@ -229,9 +229,10 @@ def make_messages(locale=None, domain='django', verbosity='1', all=False,
if file_ext in extensions:
src = open(orig_file, "rU").read()
thefile = '%s.py' % file
+ content = templatize(src, orig_file[2:])
f = open(os.path.join(dirpath, thefile), "w")
try:
- f.write(templatize(src, orig_file[2:]))
+ f.write(content)
finally:
f.close()
if verbosity > 1: