[REF] openerp.report: use the recommended syntax to raise error and never use empty except:.
bzr revid: florent.xicluna@gmail.com-20120208170217-xsa5odzlhite0nda
This commit is contained in:
parent
57ca8e4797
commit
b5fa51f4a6
|
@ -267,7 +267,7 @@ class report_custom(report_int):
|
|||
else:
|
||||
try:
|
||||
row.append(float(r[j]))
|
||||
except:
|
||||
except Exception:
|
||||
row.append(r[j])
|
||||
results2.append(row)
|
||||
if report['type']=='pie':
|
||||
|
|
|
@ -44,8 +44,8 @@ class report_int(netsvc.Service):
|
|||
def __init__(self, name):
|
||||
assert not self.exists(name), 'The report "%s" already exists!' % name
|
||||
super(report_int, self).__init__(name)
|
||||
if name[0:7]<>'report.':
|
||||
raise Exception, 'ConceptionError, bad report name, should start with "report."'
|
||||
if not name.startswith('report.'):
|
||||
raise Exception('ConceptionError, bad report name, should start with "report."')
|
||||
self.name = name
|
||||
self.id = 0
|
||||
self.name2 = '.'.join(name.split('.')[1:])
|
||||
|
|
|
@ -48,7 +48,7 @@ class report(object):
|
|||
try:
|
||||
while n.tag != txt.group(3):
|
||||
n = n.getparent()
|
||||
except:
|
||||
except Exception:
|
||||
n = node
|
||||
else:
|
||||
n = node.getparent()
|
||||
|
|
|
@ -56,7 +56,7 @@ class report_printscreen_list(report_int):
|
|||
def _parse_string(self, view):
|
||||
try:
|
||||
dom = etree.XML(view.encode('utf-8'))
|
||||
except:
|
||||
except Exception:
|
||||
dom = etree.XML(view)
|
||||
return self._parse_node(dom)
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ class _flowable(object):
|
|||
try:
|
||||
if new_child.get('style').find('terp_tblheader')!= -1:
|
||||
new_node.tag = 'th'
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
process(node,new_node)
|
||||
if new_node.get('colWidths',False):
|
||||
|
|
|
@ -424,7 +424,7 @@ class _rml_canvas(object):
|
|||
flow.drawOn(self.canvas,infos['x'],infos['y'])
|
||||
infos['height']-=h
|
||||
else:
|
||||
raise ValueError, "Not enough space"
|
||||
raise ValueError("Not enough space")
|
||||
|
||||
def _line_mode(self, node):
|
||||
ljoin = {'round':1, 'mitered':0, 'bevelled':2}
|
||||
|
|
|
@ -37,7 +37,7 @@ def _child_get(node, self=None, tagname=None):
|
|||
if n.get('rml_except', False):
|
||||
try:
|
||||
eval(n.get('rml_except'), {}, self.localcontext)
|
||||
except:
|
||||
except Exception:
|
||||
continue
|
||||
if n.get('rml_tag'):
|
||||
try:
|
||||
|
@ -46,7 +46,7 @@ def _child_get(node, self=None, tagname=None):
|
|||
n2.tag = tag
|
||||
n2.attrib.update(attr)
|
||||
yield n2
|
||||
except:
|
||||
except Exception:
|
||||
yield n
|
||||
else:
|
||||
yield n
|
||||
|
@ -55,7 +55,7 @@ def _child_get(node, self=None, tagname=None):
|
|||
if self and self.localcontext and n.get('rml_except', False):
|
||||
try:
|
||||
eval(n.get('rml_except'), {}, self.localcontext)
|
||||
except:
|
||||
except Exception:
|
||||
continue
|
||||
if (tagname is None) or (n.tag==tagname):
|
||||
yield n
|
||||
|
@ -73,7 +73,7 @@ def _process_text(self, txt):
|
|||
if sps:
|
||||
try:
|
||||
txt2 = eval(sps.pop(0),self.localcontext)
|
||||
except:
|
||||
except Exception:
|
||||
txt2 = ''
|
||||
if isinstance(txt2, (int, float)):
|
||||
txt2 = str(txt2)
|
||||
|
|
Loading…
Reference in New Issue