[Zope-Checkins] SVN: Zope/branches/ajung-zcatalog-progress/lib/python/Products/ZCatalog/ProgressHandler.py added

Andreas Jung andreas at andreas-jung.com
Wed Jul 14 11:28:46 EDT 2004


Log message for revision 26526:
  added
  


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


-=-
Added: Zope/branches/ajung-zcatalog-progress/lib/python/Products/ZCatalog/ProgressHandler.py
===================================================================
--- Zope/branches/ajung-zcatalog-progress/lib/python/Products/ZCatalog/ProgressHandler.py	2004-07-14 15:12:49 UTC (rev 26525)
+++ Zope/branches/ajung-zcatalog-progress/lib/python/Products/ZCatalog/ProgressHandler.py	2004-07-14 15:28:46 UTC (rev 26526)
@@ -0,0 +1,40 @@
+##############################################################################
+#
+# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE
+#
+##############################################################################
+
+"""
+$Id: ZCatalog.py 25050 2004-05-27 15:06:40Z chrisw $
+"""
+
+class ProgressHandler:
+    """ A simple machinery to provide progres informations for long running
+        ZCatalog operations like reindexing.
+    """
+
+    def pg_register(self, handler=None):
+        self._v_pg_handler = handler
+
+
+    def pg_init(self, max):
+        handler = getattr(self, '_v_pg_handler', None)
+        if not handler: return
+        handler.init(max)
+
+    def pg_finish(self):
+        handler = getattr(self, '_v_pg_handler', None)
+        if not handler: return
+        handler.finish()
+
+    def pg_report(self, current, *args, **kw):
+        handler = getattr(self, '_v_pg_handler', None)
+        if not handler: return
+        handler.report(current, *args, **kw)



More information about the Zope-Checkins mailing list