rml2pdf: Log stray exceptions, use special when expected.
If the eval() raises an exception, we should log that. Unless it's the one we expect to see (thus changed to a special type), where we can keep silently ignoring it. Note: the GeneratorExit requires python 2.5 . bzr revid: p_christ@hol.gr-20100621143701-oenf5fp57qs1bxz4
This commit is contained in:
parent
4afe236b0c
commit
1ee1886dcd
|
@ -63,7 +63,10 @@ def _child_get(node, self=None, tagname=None):
|
|||
if n.get('rml_except', False):
|
||||
try:
|
||||
eval(n.get('rml_except'), {}, self.localcontext)
|
||||
except GeneratorExit:
|
||||
continue
|
||||
except:
|
||||
logging.getLogger('report').exception()
|
||||
continue
|
||||
if n.get('rml_tag'):
|
||||
try:
|
||||
|
@ -72,7 +75,10 @@ def _child_get(node, self=None, tagname=None):
|
|||
n2.tag = tag
|
||||
n2.attrib.update(attr)
|
||||
yield n2
|
||||
except GeneratorExit:
|
||||
yield n
|
||||
except:
|
||||
logging.getLogger('report').exception()
|
||||
yield n
|
||||
else:
|
||||
yield n
|
||||
|
@ -81,7 +87,10 @@ def _child_get(node, self=None, tagname=None):
|
|||
if self and self.localcontext and n.get('rml_except'):
|
||||
try:
|
||||
eval(n.get('rml_except'), {}, self.localcontext)
|
||||
except GeneratorExit:
|
||||
continue
|
||||
except:
|
||||
logging.getLogger('report').exception()
|
||||
continue
|
||||
if self and self.localcontext and n.get('rml_tag'):
|
||||
try:
|
||||
|
@ -91,7 +100,10 @@ def _child_get(node, self=None, tagname=None):
|
|||
n2.attrib.update(attr or {})
|
||||
yield n2
|
||||
tagname = ''
|
||||
except GeneratorExit:
|
||||
pass
|
||||
except:
|
||||
logging.getLogger('report').exception()
|
||||
pass
|
||||
if (tagname is None) or (n.tag==tagname):
|
||||
yield n
|
||||
|
|
|
@ -192,7 +192,7 @@ class rml_parse(object):
|
|||
return text.strip()
|
||||
|
||||
def removeParentNode(self, tag=None):
|
||||
raise Exception('Skip')
|
||||
raise GeneratorExit('Skip')
|
||||
|
||||
def set_html_image(self,id,model=None,field=None,context=None):
|
||||
if not id :
|
||||
|
|
Loading…
Reference in New Issue