Add timeout to Report.convert

issue7972
review50691002
This commit is contained in:
Cédric Krier
2019-01-15 00:09:38 +01:00
parent d80f2bdbe4
commit 07c296fc27
2 changed files with 3 additions and 2 deletions
+1
View File
@@ -1,3 +1,4 @@
* Add timeout to Report.convert
* Allow records from XML with noupdate to be deleted
* Add ir.calendar for month and day
* Rename languages: hu_HU, it_IT and pt_BR into hu, it and pt
+2 -2
View File
@@ -296,7 +296,7 @@ class Report(URLMixin, PoolBase):
return data
@classmethod
def convert(cls, report, data):
def convert(cls, report, data, timeout=5 * 60):
"converts the report data to another mimetype if necessary"
input_format = report.template_extension
output_format = report.extension or report.template_extension
@@ -315,7 +315,7 @@ class Report(URLMixin, PoolBase):
'--headless', '--nolockcheck', '--nodefault', '--norestore',
'--convert-to', oext, '--outdir', dtemp, path]
output = os.path.splitext(path)[0] + os.extsep + oext
subprocess.check_call(cmd)
subprocess.check_call(cmd, timeout=timeout)
if os.path.exists(output):
with open(output, 'rb') as fp:
return oext, fp.read()