Author: mtredinnick Date: 2009-04-11 21:50:41 -0500 (Sat, 11 Apr 2009) New Revision: 10538
Modified: django/trunk/django/core/management/commands/makemessages.py Log: Fixed #10234 -- Improved error message when internationalizing templates. Patch from peterbe and Andrew Badr. Modified: django/trunk/django/core/management/commands/makemessages.py =================================================================== --- django/trunk/django/core/management/commands/makemessages.py 2009-04-12 02:43:13 UTC (rev 10537) +++ django/trunk/django/core/management/commands/makemessages.py 2009-04-12 02:50:41 UTC (rev 10538) @@ -145,7 +145,11 @@ 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"' % ( --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---