[IMP] usage of python in convert_csv

* the reduce is equivalent to any
* apply De Morgan law
* misc.ustr is a function, can just pass it directly to map

bzr revid: xmo@openerp.com-20130327155424-dfbo915tl8qhsvqu
This commit is contained in:
Xavier Morel 2013-03-27 16:54:24 +01:00
parent 66fefa7a2b
commit 461973b4c9
1 changed files with 2 additions and 2 deletions

View File

@ -915,10 +915,10 @@ def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init',
uid = 1
datas = []
for line in reader:
if (not line) or not reduce(lambda x,y: x or y, line) :
if not (line and any(line)):
continue
try:
datas.append(map(lambda x: misc.ustr(x), line))
datas.append(map(misc.ustr, line))
except:
_logger.error("Cannot import the line: %s", line)
result, rows, warning_msg, dummy = pool.get(model).import_data(cr, uid, fields, datas,mode, module, noupdate, filename=fname_partial)