comparison odfcast/convert.py @ 31:83bca7dc9bfe

Return error response when a template couldn't be rendered
author Björn Ricks <bjoern.ricks@intevation.de>
date Thu, 16 Oct 2014 11:35:19 +0200
parents 9d65de2ebe22
children e6f2f1481de2
comparison
equal deleted inserted replaced
30:9d65de2ebe22 31:83bca7dc9bfe
54 mimetype = self.get_mimetype_for_format(fformat) 54 mimetype = self.get_mimetype_for_format(fformat)
55 55
56 outfile = self.save_form_file(ffile) 56 outfile = self.save_form_file(ffile)
57 57
58 if datadict: 58 if datadict:
59 tfile = tempfile.NamedTemporaryFile() 59 try:
60 t = Template(outfile, tfile) 60 tfile = tempfile.NamedTemporaryFile()
61 t.render(datadict) 61 t = Template(outfile, tfile)
62 outfile.close() 62 t.render(datadict)
63 outfile = tfile 63 outfile.close()
64 outfile = tfile
65 except:
66 return "Template error", 500
64 67
65 if format != "odt": 68 if format != "odt":
66 try: 69 try:
67 outfile = self.convert(outfile, fformat) 70 outfile = self.convert(outfile, fformat)
68 except: 71 except:
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)