1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #12201 -- Added a lineno attibute to template Token so e.g. we can report line numbers in errors during i18n literals extraction. Thanks madewulf for the report and Claude Paroz for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14813 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Ramiro Morales
2010-12-04 17:42:54 +00:00
parent 5a7af25c7a
commit 23f69af454
7 changed files with 34 additions and 15 deletions

View File

@@ -220,18 +220,15 @@ def make_messages(locale=None, domain='django', verbosity='1', all=False,
os.unlink(os.path.join(dirpath, thefile))
elif domain == 'django' and (file_ext == '.py' or file_ext in extensions):
thefile = file
orig_file = os.path.join(dirpath, file)
if file_ext in extensions:
src = open(os.path.join(dirpath, file), "rU").read()
src = open(orig_file, "rU").read()
thefile = '%s.py' % file
f = open(os.path.join(dirpath, thefile), "w")
try:
f = open(os.path.join(dirpath, thefile), "w")
try:
f.write(templatize(src))
finally:
f.close()
except SyntaxError, msg:
msg = "%s (file: %s)" % (msg, os.path.join(dirpath, file))
raise SyntaxError(msg)
f.write(templatize(src, orig_file[2:]))
finally:
f.close()
if verbosity > 1:
sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
cmd = (
@@ -250,7 +247,7 @@ def make_messages(locale=None, domain='django', verbosity='1', all=False,
if thefile != file:
old = '#: '+os.path.join(dirpath, thefile)[2:]
new = '#: '+os.path.join(dirpath, file)[2:]
new = '#: '+orig_file[2:]
msgs = msgs.replace(old, new)
if os.path.exists(potfile):
# Strip the header