Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#22773 closed Bug (fixed)

makemessages crashes with empty templatized files

Reported by: anonymous Owned by: Claude Paroz
Component: Core (Management commands) Version: 1.7-beta-2
Severity: Normal Keywords: makemessages
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If templatize return empty string, then raise exception on fp.write.

django 1.7b4
makemessages.py:97

content = templatize(src_data, orig_file[2:])  # return '' (str)
with io.open(os.path.join(self.dirpath, thefile), "w", encoding='utf-8') as fp:
    fp.write(content)  # TypeError: must be unicode, not str

Tested in Windows7x64, Python 2.7.7x87

Change History (3)

comment:1 by Claude Paroz, 11 years ago

Owner: changed from nobody to Claude Paroz
Status: newassigned
Summary: makemessages bugmakemessages crashes with empty templatized files
Triage Stage: UnreviewedAccepted

comment:2 by Claude Paroz <claude@…>, 11 years ago

Resolution: fixed
Status: assignedclosed

In daaeb8415823444a9020460cf825efc3fae866a2:

Fixed #22773 -- Forced templatize() to return unicode

comment:3 by Claude Paroz <claude@…>, 11 years ago

In b236a5581898aca7bff082a6d642bf457278c658:

[1.7.x] Fixed #22773 -- Forced templatize() to return unicode

Backport of daaeb84158 from master.

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