summaryrefslogtreecommitdiff
path: root/bin/report/render/html2html/html2html.py
diff options
context:
space:
mode:
authordsh (Open ERP) <dsh@tinyerp.com>2009-05-22 12:46:34 +0530
committerdsh (Open ERP) <dsh@tinyerp.com>2009-05-22 12:46:34 +0530
commit2387a50c2bd85f5fe2d444a56259fc0bf051240b (patch)
tree9ae69e1613c3de9a5e5b0ef193a7c7c783df3363 /bin/report/render/html2html/html2html.py
parent94ad944c20179a9b0080c3b2c4925bc692d24eff (diff)
bug fix
bzr revid: dsh@tinyerp.com-20090522071634-uqui7cyb2g9jal78
Diffstat (limited to 'bin/report/render/html2html/html2html.py')
-rw-r--r--bin/report/render/html2html/html2html.py23
1 files changed, 13 insertions, 10 deletions
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: