summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorced <>2007-09-20 08:47:44 +0000
committerced <>2007-09-20 08:47:44 +0000
commit548dd08c59c24776488a920481c3bd98b5efcf5f (patch)
tree30c5112ca83f63716be1b166ca67f0a427e2ad74 /bin
parentf46e46bc65b7a27256c0ebb1021aaf734193b85d (diff)
Process all the csv file in one step
prevent to cut a one2many line bzr revid: ced-0a86524706e498aa4ce58260df97daf40bba0165
Diffstat (limited to 'bin')
-rw-r--r--bin/tools/convert.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/bin/tools/convert.py b/bin/tools/convert.py
index 7f3f5723231..c278b7c9dae 100644
--- a/bin/tools/convert.py
+++ b/bin/tools/convert.py
@@ -608,9 +608,8 @@ class xml_import(object):
'act_window': self._tag_act_window,
}
-CSV_STEP = 500
-
-def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init', noupdate=False):
+def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init',
+ noupdate=False):
'''Import csv file :
quote: "
delimiter: ,
@@ -623,7 +622,7 @@ def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init', n
pool = pooler.get_pool(cr.dbname)
- input=StringIO.StringIO(csvcontent)
+ input = StringIO.StringIO(csvcontent)
reader = csv.reader(input, quotechar='"', delimiter=',')
fields = reader.next()
@@ -634,11 +633,7 @@ def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init', n
datas = []
for line in reader:
datas.append( map(lambda x:x.decode('utf8').encode('utf8'), line))
- if len(datas) > CSV_STEP:
- pool.get(model).import_data(cr, uid, fields, datas,mode, module,noupdate)
- datas=[]
- if datas:
- pool.get(model).import_data(cr, uid, fields, datas,mode, module,noupdate)
+ pool.get(model).import_data(cr, uid, fields, datas,mode, module,noupdate)
#
# xml import/export