diff options
| author | Naresh Choksy <nch@tinyerp.com> | 2009-05-12 16:49:55 +0530 |
|---|---|---|
| committer | Naresh Choksy <nch@tinyerp.com> | 2009-05-12 16:49:55 +0530 |
| commit | 9fa12bafaa9cd78c43490be36fcb76b3d197b7ea (patch) | |
| tree | bc484eb4f16cf5e691e0436aa89d7b0ca2ab4cb4 /bin/report/render | |
| parent | c54fa973e060dceb6da89a4160ce32d8dbe408a0 (diff) | |
Bugfix:setTag
bzr revid: nch@tinyerp.com-20090512111955-x70z0zu770k0qq8x
Diffstat (limited to 'bin/report/render')
| -rw-r--r-- | bin/report/render/rml2pdf/trml2pdf.py | 6 | ||||
| -rw-r--r-- | bin/report/render/rml2pdf/utils.py | 14 |
2 files changed, 16 insertions, 4 deletions
diff --git a/bin/report/render/rml2pdf/trml2pdf.py b/bin/report/render/rml2pdf/trml2pdf.py index efde722f0ed..a7741e9b76e 100644 --- a/bin/report/render/rml2pdf/trml2pdf.py +++ b/bin/report/render/rml2pdf/trml2pdf.py @@ -453,7 +453,7 @@ class _rml_flowable(object): return rc1 def _table(self, node): - childs = utils._child_get(node,self,'tr') + childs = list(utils._child_get(node,self,'tr')) if not childs: return None length = 0 @@ -474,7 +474,7 @@ class _rml_flowable(object): paraStyle = self.styles.styles[tr.get('paraStyle')] data2 = [] posx = 0 - for td in utils._child_get(tr, self,'td'): + for td in list(utils._child_get(tr, self,'td')): if td.get('style'): st = copy.deepcopy(self.styles.table_styles[td.get('style')]) for s in st._cmds: @@ -489,7 +489,7 @@ class _rml_flowable(object): posx += 1 flow = [] - for n in utils._child_get(td, self): + for n in list(utils._child_get(td, self)): fl = self._flowable(n, extra_style=paraStyle) if isinstance(fl,list): flow += fl diff --git a/bin/report/render/rml2pdf/utils.py b/bin/report/render/rml2pdf/utils.py index 2102912e974..ce54c50a9a5 100644 --- a/bin/report/render/rml2pdf/utils.py +++ b/bin/report/render/rml2pdf/utils.py @@ -40,6 +40,7 @@ import re import reportlab from lxml import etree +import copy _regex = re.compile('\[\[(.+?)\]\]') @@ -47,6 +48,7 @@ def _child_get(node, self=None, tagname=None): for n in node: if self and self.localcontext and n.get('rml_loop', False): oldctx = self.localcontext + for ctx in eval(n.get('rml_loop'),{}, self.localcontext): self.localcontext.update(ctx) if (tagname is None) or (n.tag==tagname): @@ -58,7 +60,7 @@ def _child_get(node, self=None, tagname=None): if n.get('rml_tag'): try: (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) - n2 = copy.copy(n) + n2 = copy.deepcopy(n) n2.tag = tag n2.attrib.update(attr) yield n2 @@ -73,6 +75,16 @@ def _child_get(node, self=None, tagname=None): eval(n.get('rml_except'), {}, self.localcontext) except: continue + if self and self.localcontext and n.get('rml_tag', False): + try: + (tag,attr) = eval(n.get('rml_tag'),{}, self.localcontext) + n2 = copy.deepcopy(n) + n2.tag = tag + n2.attrib.update(attr) + yield n2 + tagname = '' + except: + pass if (tagname is None) or (n.tag==tagname): yield n |
