[REF] openerp.report: better use of isinstance.

bzr revid: florent.xicluna@gmail.com-20120208170034-2w8szxy350qpwas6
This commit is contained in:
Florent Xicluna 2012-02-08 18:00:34 +01:00
parent 4027d619eb
commit 57ca8e4797
2 changed files with 3 additions and 3 deletions

View File

@ -108,7 +108,7 @@ class report_custom(report_int):
key = levels.keys()
for l in key:
objs = eval('obj.'+l,{'obj': obj})
if not isinstance(objs, browse_record_list) and type(objs) <> type([]):
if not isinstance(objs, (browse_record_list, list)):
objs = [objs]
field_new = []
cond_new = []

View File

@ -75,9 +75,9 @@ def _process_text(self, txt):
txt2 = eval(sps.pop(0),self.localcontext)
except:
txt2 = ''
if type(txt2) == type(0) or type(txt2) == type(0.0):
if isinstance(txt2, (int, float)):
txt2 = str(txt2)
if type(txt2)==type('') or type(txt2)==type(u''):
if isinstance(txt2, basestring):
result += txt2
return result