Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#10234 closed (fixed)

makemessages.py SyntaxErrors are hard to track because they don't say which template or file it happened in

Reported by: Peter Bengtsson Owned by: Andrew Badr
Component: Internationalization Version: dev
Severity: Keywords: django-admin
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

I ran django-admin.py makemessages -l sv and it turns out that I had forgotten the 'end' on {% endblocktrans %} so it threw this error:

SyntaxError: Translation blocks must not include other block tags: blocktrans

If you have many files with blocktrans in them it's hard to know where you've make the syntax error.
I patched makemessages.py to also include the filename into error message. Now the error message looks like this instead:

SyntaxError: Translation blocks must not include other block tags: blocktrans (file: ./search/templates/500.html)

Attachments (2)

makemessages.py.diff (402 bytes ) - added by Peter Bengtsson 16 years ago.
belongs in django/core/management/commands/
makemessages_t10234_r10177.diff (1.2 KB ) - added by Andrew Badr 16 years ago.
Same patch, corrected format

Download all attachments as: .zip

Change History (8)

by Peter Bengtsson, 16 years ago

Attachment: makemessages.py.diff added

belongs in django/core/management/commands/

comment:1 by Peter Bengtsson, 16 years ago

Noticed that when you download the .diff file or when you try to view it here on Trac it shows as just one line. Weird.

in reply to:  1 comment:2 by Ramiro Morales, 16 years ago

Patch needs improvement: set

Replying to peterbe:

Noticed that when you download the .diff file or when you try to view it here on Trac it shows as just one line. Weird.

The patch contents looks mostly ok when you download it. Please generate it from the root of the django tree so the .diff header contains the django/core/management/commands/makemessages.py path. Also, specify the -u (unified) to diff, this will solve the Trac display problem.

This is described at http://docs.djangoproject.com/en/dev/internals/contributing/#patch-style.

Thanks for you contribution!

comment:3 by Jacob, 16 years ago

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:4 by Andrew Badr, 16 years ago

Owner: changed from nobody to Andrew Badr

Going to duplicate the original patch

by Andrew Badr, 16 years ago

Same patch, corrected format

comment:5 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: newclosed

(In [10538]) Fixed #10234 -- Improved error message when internationalizing templates.

Patch from peterbe and Andrew Badr.

comment:6 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

Note: See TracTickets for help on using tickets.
Back to Top