[FIX] rml2pdf: allow missing/null image contents
bzr revid: odo@openerp.com-20100830095946-a028170mlds8upre
This commit is contained in:
parent
62e7869832
commit
6e3c34ddd5
|
@ -364,15 +364,18 @@ class _rml_canvas(object):
|
|||
image_data = self.images[node.get('name')]
|
||||
s = cStringIO.StringIO(image_data)
|
||||
else:
|
||||
import base64
|
||||
if self.localcontext:
|
||||
res = utils._regex.findall(node.text)
|
||||
for key in res:
|
||||
newtext = eval(key, {}, self.localcontext)
|
||||
node.text = newtext
|
||||
image_data = base64.decodestring(node.text)
|
||||
if not image_data: return False
|
||||
s = cStringIO.StringIO(image_data)
|
||||
res = utils._regex.findall(node.text)
|
||||
for key in res:
|
||||
newtext = eval(key, {}, self.localcontext)
|
||||
node.text = newtext
|
||||
image_data = None
|
||||
if node.text:
|
||||
image_data = base64.decodestring(node.text)
|
||||
if image_data:
|
||||
s = cStringIO.StringIO(image_data)
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
if node.get('file') in self.images:
|
||||
s = cStringIO.StringIO(self.images[node.get('file')])
|
||||
|
|
Loading…
Reference in New Issue