changeset 269b7c6621ea in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset;node=269b7c6621ea
description:
        Add timeout to Report.convert

        issue7972
        review50691002
diffstat:

 CHANGELOG                |  1 +
 trytond/report/report.py |  4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 0ec012410a55 -r 269b7c6621ea CHANGELOG
--- a/CHANGELOG Tue Jan 15 00:02:19 2019 +0100
+++ b/CHANGELOG Tue Jan 15 00:09:38 2019 +0100
@@ -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 -r 0ec012410a55 -r 269b7c6621ea trytond/report/report.py
--- a/trytond/report/report.py  Tue Jan 15 00:02:19 2019 +0100
+++ b/trytond/report/report.py  Tue Jan 15 00:09:38 2019 +0100
@@ -296,7 +296,7 @@
         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 @@
                 '--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()

Reply via email to