From 1340218b68e69579a6bd5a8db70f0e1a125b0fab Mon Sep 17 00:00:00 2001 From: "dsh (Open ERP)" Date: Fri, 22 May 2009 11:34:27 +0530 Subject: small change bzr revid: dsh@tinyerp.com-20090522060427-so6i5s127430oq1j --- bin/report/render/html2html/html2html.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'bin/report/render/html2html/html2html.py') diff --git a/bin/report/render/html2html/html2html.py b/bin/report/render/html2html/html2html.py index 28c22f4b10e..0fd5a687386 100644 --- a/bin/report/render/html2html/html2html.py +++ b/bin/report/render/html2html/html2html.py @@ -24,6 +24,8 @@ from report.render.rml2pdf import utils from lxml import etree import copy import pooler +import base64 +from reportlab.lib.utils import ImageReader class html2html(object): @@ -49,6 +51,11 @@ class html2html(object): src = utils._process_text(self, new_child.get('name')) if src : new_child.set('src','data:image/gif;base64,%s'%src) + output = cStringIO.StringIO(base64.decodestring(src)) + img = ImageReader(output) + (width,height) = img.getSize() + new_child.set('width',str(width)) + new_child.set('height',str(height)) else : new_child.getparent().remove(new_child) new_child.text = utils._process_text(self, child.text) -- cgit v1.2.3 From 94ad944c20179a9b0080c3b2c4925bc692d24eff Mon Sep 17 00:00:00 2001 From: "dsh (Open ERP)" Date: Fri, 22 May 2009 11:42:16 +0530 Subject: small change bzr revid: dsh@tinyerp.com-20090522061216-tgvmfw0pwq829a70 --- bin/report/render/html2html/html2html.py | 1 + 1 file changed, 1 insertion(+) (limited to 'bin/report/render/html2html/html2html.py') diff --git a/bin/report/render/html2html/html2html.py b/bin/report/render/html2html/html2html.py index 0fd5a687386..c65e15342d4 100644 --- a/bin/report/render/html2html/html2html.py +++ b/bin/report/render/html2html/html2html.py @@ -25,6 +25,7 @@ from lxml import etree import copy import pooler import base64 +import cStringIO from reportlab.lib.utils import ImageReader -- cgit v1.2.3 From 2387a50c2bd85f5fe2d444a56259fc0bf051240b Mon Sep 17 00:00:00 2001 From: "dsh (Open ERP)" Date: Fri, 22 May 2009 12:46:34 +0530 Subject: bug fix bzr revid: dsh@tinyerp.com-20090522071634-uqui7cyb2g9jal78 --- bin/report/render/html2html/html2html.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'bin/report/render/html2html/html2html.py') diff --git a/bin/report/render/html2html/html2html.py b/bin/report/render/html2html/html2html.py index c65e15342d4..fb1f6fcedd0 100644 --- a/bin/report/render/html2html/html2html.py +++ b/bin/report/render/html2html/html2html.py @@ -26,8 +26,10 @@ import copy import pooler import base64 import cStringIO +import re from reportlab.lib.utils import ImageReader +_regex = re.compile('\[\[(.+?)\]\]') class html2html(object): def __init__(self, html, localcontext): @@ -49,16 +51,17 @@ class html2html(object): process_text(child, new_child) else: if new_child.tag=='img' and new_child.get('name'): - src = utils._process_text(self, new_child.get('name')) - if src : - new_child.set('src','data:image/gif;base64,%s'%src) - output = cStringIO.StringIO(base64.decodestring(src)) - img = ImageReader(output) - (width,height) = img.getSize() - new_child.set('width',str(width)) - new_child.set('height',str(height)) - else : - new_child.getparent().remove(new_child) + if _regex.findall(new_child.get('name')) : + src = utils._process_text(self, new_child.get('name')) + if src : + new_child.set('src','data:image/gif;base64,%s'%src) + output = cStringIO.StringIO(base64.decodestring(src)) + img = ImageReader(output) + (width,height) = img.getSize() + new_child.set('width',str(width)) + new_child.set('height',str(height)) + else : + new_child.getparent().remove(new_child) new_child.text = utils._process_text(self, child.text) self._node = copy.deepcopy(self.etree) for n in self._node: -- cgit v1.2.3 From 74b2bb3e40beffef00a91a99e50b1e3122d1f233 Mon Sep 17 00:00:00 2001 From: "dsh (Open ERP)" Date: Mon, 1 Jun 2009 12:51:49 +0530 Subject: bug fix for image size in htmland modifyreport bzr revid: dsh@tinyerp.com-20090601072149-xpjplc49k7jrnaz3 --- bin/report/render/html2html/html2html.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bin/report/render/html2html/html2html.py') diff --git a/bin/report/render/html2html/html2html.py b/bin/report/render/html2html/html2html.py index fb1f6fcedd0..d4fa8559720 100644 --- a/bin/report/render/html2html/html2html.py +++ b/bin/report/render/html2html/html2html.py @@ -58,8 +58,10 @@ class html2html(object): output = cStringIO.StringIO(base64.decodestring(src)) img = ImageReader(output) (width,height) = img.getSize() - new_child.set('width',str(width)) - new_child.set('height',str(height)) + if not new_child.get('width'): + new_child.set('width',str(width)) + if not new_child.get('height') : + new_child.set('height',str(height)) else : new_child.getparent().remove(new_child) new_child.text = utils._process_text(self, child.text) -- cgit v1.2.3 From 6a62711467381b7de2d66c78ada9cdc5b67bc325 Mon Sep 17 00:00:00 2001 From: "dsh (Open ERP)" Date: Thu, 4 Jun 2009 16:58:39 +0530 Subject: bug fix(skip text if child nodes are there) for the html2html and openoffice reports bzr revid: dsh@tinyerp.com-20090604112839-91d7pj22oos69wsd --- bin/report/render/html2html/html2html.py | 1 + 1 file changed, 1 insertion(+) (limited to 'bin/report/render/html2html/html2html.py') diff --git a/bin/report/render/html2html/html2html.py b/bin/report/render/html2html/html2html.py index d4fa8559720..2cf5b147dd0 100644 --- a/bin/report/render/html2html/html2html.py +++ b/bin/report/render/html2html/html2html.py @@ -47,6 +47,7 @@ class html2html(object): new_node.append(new_child) if len(child): for n in new_child: + new_child.text = utils._process_text(self, child.text) new_child.remove(n) process_text(child, new_child) else: -- cgit v1.2.3