summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-04-12 02:50:41 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-04-12 02:50:41 +0000
commit794f2d121e9fd51debfabc8bdc8d6833dc61d7a4 (patch)
tree90f035bc3aeb4a633143f565a8f1c1b9866b37b5 /django
parentcc10f50c192ee8d789c443e6d58dc10babc753b3 (diff)
Fixed #10234 -- Improved error message when internationalizing templates.
Patch from peterbe and Andrew Badr. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10538 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/core/management/commands/makemessages.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py
index d33c5b065f..c8c34735f2 100644
--- a/django/core/management/commands/makemessages.py
+++ b/django/core/management/commands/makemessages.py
@@ -145,7 +145,11 @@ def make_messages(locale=None, domain='django', verbosity='1', all=False, extens
if file_ext in extensions:
src = open(os.path.join(dirpath, file), "rU").read()
thefile = '%s.py' % file
- open(os.path.join(dirpath, thefile), "w").write(templatize(src))
+ try:
+ open(os.path.join(dirpath, thefile), "w").write(templatize(src))
+ except SyntaxError, msg:
+ msg = "%s (file: %s)" % (msg, os.path.join(dirpath, file))
+ raise SyntaxError(msg)
if verbosity > 1:
sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
cmd = 'xgettext -d %s -L Python --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --keyword=ugettext_noop --keyword=ugettext_lazy --keyword=ungettext_lazy:1,2 --from-code UTF-8 -o - "%s"' % (