From 07c296fc274c5f33ec8d86735c4b2dd1657cb06d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 15 Jan 2019 00:09:38 +0100 Subject: [PATCH] Add timeout to Report.convert issue7972 review50691002 --- CHANGELOG | 1 + trytond/report/report.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index aa33778aea..2ba2e86a26 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/trytond/report/report.py b/trytond/report/report.py index e1cc6ce5e4..11504a6950 100644 --- a/trytond/report/report.py +++ b/trytond/report/report.py @@ -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()