[Zope-Checkins] SVN: Zope/branches/ajung-zcatalog-progress/lib/python/Products/ZCatalog/ added logging of subtransaction commits

Andreas Jung andreas at andreas-jung.com
Fri Jul 16 05:51:44 EDT 2004


Log message for revision 26571:
  added logging of subtransaction commits
  


Changed:
  U   Zope/branches/ajung-zcatalog-progress/lib/python/Products/ZCatalog/ProgressHandler.py
  U   Zope/branches/ajung-zcatalog-progress/lib/python/Products/ZCatalog/ZCatalog.py


-=-
Modified: Zope/branches/ajung-zcatalog-progress/lib/python/Products/ZCatalog/ProgressHandler.py
===================================================================
--- Zope/branches/ajung-zcatalog-progress/lib/python/Products/ZCatalog/ProgressHandler.py	2004-07-16 07:54:40 UTC (rev 26570)
+++ Zope/branches/ajung-zcatalog-progress/lib/python/Products/ZCatalog/ProgressHandler.py	2004-07-16 09:51:43 UTC (rev 26571)
@@ -32,6 +32,9 @@
             'max' -- maximum number of objects to be processed (int)
         """ 
 
+    def info(text):
+        """ Log some 'text'"""
+
     def finish():
         """ Called up termination """
 
@@ -61,6 +64,9 @@
         self.fp = sys.stdout
         self.output('Process started (%d objects to go)' % self._max)
 
+    def info(self, text):
+        self.output(text)
+
     def finish(self):
         self.output('Process terminated. Duration: %0.2f seconds' % \
                     (time.time() -self._start))

Modified: Zope/branches/ajung-zcatalog-progress/lib/python/Products/ZCatalog/ZCatalog.py
===================================================================
--- Zope/branches/ajung-zcatalog-progress/lib/python/Products/ZCatalog/ZCatalog.py	2004-07-16 07:54:40 UTC (rev 26570)
+++ Zope/branches/ajung-zcatalog-progress/lib/python/Products/ZCatalog/ZCatalog.py	2004-07-16 09:51:43 UTC (rev 26571)
@@ -289,7 +289,7 @@
                 obj = self.resolve_url(p, self.REQUEST)
             if obj is not None:
                 try:
-                    self.catalog_object(obj, p)
+                    self.catalog_object(obj, p, pghandler=pghandler)
                 except ConflictError:
                     raise
                 except:
@@ -491,7 +491,7 @@
                 # index via the UI
                 try:
                     self.catalog_object(obj, p, idxs=name,
-                                        update_metadata=0)
+                                        update_metadata=0, pghandler=pghandler)
                 except TypeError:
                     # Fall back to Zope 2.6.2 interface. This is necessary for
                     # products like CMF 1.4.2 and earlier that subclass from
@@ -501,7 +501,7 @@
                     warn('catalog_object interface of %s not up to date'
                          % self.__class__.__name__,
                          DeprecationWarning)
-                    self.catalog_object(obj, p, idxs=name)
+                    self.catalog_object(obj, p, idxs=name, pghandler=pghandler)
 
         if pghandler:
             pghandler.finish()
@@ -530,7 +530,7 @@
         return Splitter.availableSplitters
 
 
-    def catalog_object(self, obj, uid=None, idxs=None, update_metadata=1):
+    def catalog_object(self, obj, uid=None, idxs=None, update_metadata=1, pghandler=None):
         """ wrapper around catalog """
 
         if uid is None:
@@ -572,6 +572,8 @@
                 get_transaction().commit(1)
                 self._p_jar.cacheGC()
                 self._v_total = 0
+                if pghandler:
+                    pghandler.info('commiting subtransaction')
 
     def uncatalog_object(self, uid):
         """Wrapper around catalog """



More information about the Zope-Checkins mailing list