← Back to team overview

openerp-community team mailing list archive

lp:~etienne-bauger/sugarcrm-openerp/6.1_import_sugarcrm_improvements into lp:~openerp-community/sugarcrm-openerp/6.1_import_sugarcrm_improvements

 

Étienne Beaudry Auger has proposed merging lp:~etienne-bauger/sugarcrm-openerp/6.1_import_sugarcrm_improvements into lp:~openerp-community/sugarcrm-openerp/6.1_import_sugarcrm_improvements.

Requested reviews:
  OpenERP Community (openerp-community)

For more details, see:
https://code.launchpad.net/~etienne-bauger/sugarcrm-openerp/6.1_import_sugarcrm_improvements/+merge/139258

[IMP] Add log indication for get data procedure
-- 
https://code.launchpad.net/~etienne-bauger/sugarcrm-openerp/6.1_import_sugarcrm_improvements/+merge/139258
Your team OpenERP Community is requested to review the proposed merge of lp:~etienne-bauger/sugarcrm-openerp/6.1_import_sugarcrm_improvements into lp:~openerp-community/sugarcrm-openerp/6.1_import_sugarcrm_improvements.
=== modified file 'import_sugarcrm/import_sugarcrm.py'
--- import_sugarcrm/import_sugarcrm.py	2012-12-11 14:22:11 +0000
+++ import_sugarcrm/import_sugarcrm.py	2012-12-11 16:41:20 +0000
@@ -24,6 +24,7 @@
 from import_base.import_framework import *
 from import_base.mapper import *
 from datetime import datetime
+import logging
 import base64
 import pprint
 pp = pprint.PrettyPrinter(indent=4)
@@ -70,6 +71,7 @@
     TABLE_DOCUMENT = 'Documents'
     TABLE_HISTORY_ATTACHMNET = 'history_attachment'
     
+    #MAX_RESULT_PER_PAGE = 200 #default
     MAX_RESULT_PER_PAGE = 200
     
     def initialize(self):
@@ -79,16 +81,22 @@
             raise osv.except_osv(_('Error !'), _('Authentication error !\nBad Username or Password or bad SugarSoap Api url !'))
         self.context['port'] = PortType
         self.context['session_id'] = sessionid
+        self.logger = logging.getLogger('import_sugarcrm')
+
         
     def get_data(self, table):
         offset = 0
         res = []
+        self.logger.info(' Get data from : %s , start' % (table))
         while True:
             r = sugar.search(self.context.get('port'), self.context.get('session_id'), table, offset, self.MAX_RESULT_PER_PAGE)
             res.extend(r)
             if len(r) < self.MAX_RESULT_PER_PAGE:
                 break;
+            self.logger.info('--->len    : ' + str(len(r)))
+            self.logger.info('--->offset : ' + str(offset))
             offset += self.MAX_RESULT_PER_PAGE
+        self.logger.info(' Get data from : %s complete' % (table))
         return res
     
     #def get_link(self, from_table, ids, to_table):