F [devtools] by default dataimport prints message on stdout 3.5
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Wed, 26 Aug 2009 19:53:01 +0200
branch3.5
changeset 3029 bc573d5fb5b7
parent 3022 238ad682bcb7
child 3032 f0ae6a5aba3e
F [devtools] by default dataimport prints message on stdout
devtools/dataimport.py
--- a/devtools/dataimport.py	Wed Aug 26 14:36:00 2009 +0200
+++ b/devtools/dataimport.py	Wed Aug 26 19:53:01 2009 +0200
@@ -36,14 +36,9 @@
 
   GENERATORS.append( (gen_users, CHK) )
 
-  # progress callback
-  def tell(msg):
-      print msg
-
   # create controller
   ctl = CWImportController(RQLObjectStore())
   ctl.askerror = True
-  ctl._tell = tell
   ctl.generators = GENERATORS
   ctl.store._checkpoint = checkpoint
   ctl.store._rql = rql
@@ -75,6 +70,9 @@
     for row in reader:
         yield dict(zip(header, row))
 
+def tell(msg):
+    print msg
+
 # base sanitizing functions #####
 
 def capitalize_if_unicase(txt):
@@ -219,6 +217,7 @@
         self.data = {}
         self.errors = None
         self.askerror = False
+        self._tell = tell
 
     def check(self, type, key, value):
         self._checks.setdefault(type, {}).setdefault(key, []).append(value)