:return: the list of extracted messages
:rtype: `list`
"""
- fileobj = open(filename, 'U')
+ fileobj = open(filename, 'rb')
try:
return list(extract(method, fileobj, keywords, comment_tags, options,
strip_comment_tags))
def run(self):
mappings = self._get_mappings()
- outfile = open(self.output_file, 'w')
+ outfile = open(self.output_file, 'wb')
try:
catalog = Catalog(project=self.distribution.get_name(),
version=self.distribution.get_version(),
catalog.revision_date = datetime.now(LOCALTZ)
catalog.fuzzy = False
- outfile = open(self.output_file, 'w')
+ outfile = open(self.output_file, 'wb')
try:
write_po(outfile, catalog, width=self.width)
finally:
if options.output not in (None, '-'):
self.log.info('writing PO template file to %s' % options.output)
- outfile = open(options.output, 'w')
+ outfile = open(options.output, 'wb')
close_output = True
else:
outfile = sys.stdout
self.log.info('creating catalog %r based on %r', options.output_file,
options.input_file)
- outfile = open(options.output_file, 'w')
+ outfile = open(options.output_file, 'wb')
try:
write_po(outfile, catalog, width=options.width)
finally:
long_message = '"'+ 'xxxxx '*15 + '"'
- with open('project/i18n/messages.pot', 'U') as f:
- pot_contents = f.read()
+ with open('project/i18n/messages.pot', 'rb') as f:
+ pot_contents = f.read().decode('latin-1')
pot_with_very_long_line = pot_contents.replace('"bar"', long_message)
with open(self.cmd.input_file, 'wb') as f:
- f.write(pot_with_very_long_line)
+ f.write(pot_with_very_long_line.encode('latin-1'))
self.cmd.no_wrap = True
self.cmd.finalize_options()
long_message = '"'+ 'xxxxx '*15 + '"'
- with open('project/i18n/messages.pot', 'U') as f:
- pot_contents = f.read()
+ with open('project/i18n/messages.pot', 'rb') as f:
+ pot_contents = f.read().decode('latin-1')
pot_with_very_long_line = pot_contents.replace('"bar"', long_message)
with open(self.cmd.input_file, 'wb') as f:
- f.write(pot_with_very_long_line)
+ f.write(pot_with_very_long_line.encode('latin-1'))
self.cmd.width = 120
self.cmd.finalize_options()
self.cmd.run()