workflows: handle rtf as text (#36515)

This commit is contained in:
Frédéric Péters 2019-11-15 16:25:04 +01:00
parent 81f2f7d90c
commit 091ba4ae15
1 changed files with 5 additions and 2 deletions

View File

@ -403,8 +403,11 @@ class ExportToModel(WorkflowStatusItem):
try:
# force ezt_only=True because an RTF file may contain {{ characters
# and would be seen as a Django template
return StringIO(template_on_formdata(formdata, self.model_file.get_file().read(),
ezt_format=ezt.FORMAT_RTF, ezt_only=True))
return StringIO(template_on_formdata(
formdata,
force_text(self.model_file.get_file().read()),
ezt_format=ezt.FORMAT_RTF,
ezt_only=True))
except TemplateError as e:
url = formdata.get_url()
get_logger().error('error in template for export to model [%s]: %s' % (url, str(e)))