From dcf275be04ff1c1733cca09613fda61e6d241e32 Mon Sep 17 00:00:00 2001 From: "nch@tinyerp.com" <> Date: Fri, 9 Oct 2009 16:03:54 +0530 Subject: [PATCH 1/2] [FIX]: problem Report Engine bzr revid: nch@tinyerp.com-20091009103354-u2z9v03jc864yekh --- bin/report/render/rml2pdf/trml2pdf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/report/render/rml2pdf/trml2pdf.py b/bin/report/render/rml2pdf/trml2pdf.py index f4b70a2da27..b3585254eb3 100644 --- a/bin/report/render/rml2pdf/trml2pdf.py +++ b/bin/report/render/rml2pdf/trml2pdf.py @@ -455,10 +455,10 @@ class _rml_flowable(object): if key in ('rml_except', 'rml_loop', 'rml_tag'): del txt_n.attrib[key] if True or not self._textual(n).isspace(): - txt_n.text = utils.xml2str(self._textual(n)) - txt_n.tail = '' + if not n.tag == 'bullet': + txt_n.text = utils.xml2str(self._textual(n)) + txt_n.tail = n.tail and utils._process_text(self, n.tail.replace('\n','')) or '' rc1 += etree.tostring(txt_n) - #rc1 += utils._process_text(self, node.tail or '') return rc1 def _table(self, node): From efc0d3b001b9252b367d1b1f1dd7b088ff6395d7 Mon Sep 17 00:00:00 2001 From: "nch@tinyerp.com" <> Date: Fri, 9 Oct 2009 16:15:47 +0530 Subject: [PATCH 2/2] [REF]:notified channel when there is an exception in eval() bzr revid: nch@tinyerp.com-20091009104547-t88ktqax7p5q57bz --- bin/report/render/rml2pdf/utils.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bin/report/render/rml2pdf/utils.py b/bin/report/render/rml2pdf/utils.py index 07bbbbcd05e..abc421a0f2f 100644 --- a/bin/report/render/rml2pdf/utils.py +++ b/bin/report/render/rml2pdf/utils.py @@ -43,6 +43,8 @@ from lxml import etree import copy import tools import locale +import netsvc +import traceback, sys _regex = re.compile('\[\[(.+?)\]\]') @@ -108,9 +110,13 @@ def _process_text(self, txt): result += self.localcontext.get('translate', lambda x:x)(sps.pop(0)) if sps: try: - txt = eval(sps.pop(0),self.localcontext) - except: - pass + expr = sps.pop(0) + txt = eval(expr,self.localcontext) + except Exception,e: + tb_s = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback)) + netsvc.Logger().notifyChannel('report', netsvc.LOG_ERROR, + 'report :\n%s\n%s\nexpr: %s' % (tb_s, str(e), + expr.encode('utf-8'))) if type(txt)==type('') or type(txt)==type(u''): txt2 = str2xml(txt) result += tools.ustr(txt2) @@ -173,7 +179,7 @@ def attr_get(node, attrs, dict={}): res[key] = int(node.get(key)) elif dict[key]=='unit': res[key] = unit_get(node.get(key)) - elif dict[key] == 'float' : + elif dict[key] == 'float' : res[key] = float(node.get(key)) return res