Correction pour la passage en python 3

This commit is contained in:
Benjamin Bohard 2020-08-05 14:28:55 +02:00
parent 00ff5356c9
commit 356a0a9689
1 changed files with 9 additions and 9 deletions

View File

@ -58,27 +58,27 @@ def main():
name = args.name name = args.name
if name: if name:
if path.splitext(name)[1] == '': if path.splitext(name)[1] == '':
name = name.decode('utf-8') + u'.tex' name = name + '.tex'
else: else:
name = get_unique_name('formation') name = get_unique_name('formation')
title = args.title title = args.title
if not title: if not title:
title = u'FIXME' title = 'FIXME'
else: else:
title = title.decode('utf-8') title = title
author = args.author author = args.author
if not author: if not author:
author = u'Cadoles' author = 'Cadoles'
else: else:
author = author.decode('utf-8') author = author
client = args.client client = args.client
if not client: if not client:
client = u'FIXME' client = 'FIXME'
else: else:
client = client.decode('utf-8') client = client
directory = args.directory directory = args.directory
if not directory: if not directory:
@ -118,7 +118,7 @@ def main():
makedirs(directory) makedirs(directory)
template_dest_name = name if template_file == master else template_file template_dest_name = name if template_file == master else template_file
with open(path.join(directory, template_dest_name), 'w') as rendered_file: with open(path.join(directory, template_dest_name), 'w') as rendered_file:
rendered_file.write(rendered_template.encode('utf-8')) rendered_file.write(rendered_template)
def update(args): def update(args):
""" """
@ -151,7 +151,7 @@ def main():
'name': dest} 'name': dest}
rendered_template = template.render(**env) rendered_template = template.render(**env)
with open(dest, 'w') as rendered_file: with open(dest, 'w') as rendered_file:
rendered_file.write(rendered_template.encode('utf-8')) rendered_file.write(rendered_template)
def outline(args): def outline(args):