Log message for revision 81408:
  Made Helpsys.HelpSys internal ZCatalog creation lazy, so it isn't created 
unless first accessed.
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/HelpSys/HelpSys.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt  2007-11-02 09:47:35 UTC (rev 81407)
+++ Zope/trunk/doc/CHANGES.txt  2007-11-02 11:27:15 UTC (rev 81408)
@@ -9,6 +9,9 @@
 
     Restructuring
 
+      - Made Helpsys.HelpSys internal ZCatalog creation lazy, so it isn't
+        created unless first accessed.
+
       - Turned deprecation warnings for manage_afterAdd, manage_beforeDelete
         and manage_afterClone methods into discouraged warnings. These methods
         will not be removed in Zope 2.11, but stay for the foreseeable future.

Modified: Zope/trunk/lib/python/HelpSys/HelpSys.py
===================================================================
--- Zope/trunk/lib/python/HelpSys/HelpSys.py    2007-11-02 09:47:35 UTC (rev 
81407)
+++ Zope/trunk/lib/python/HelpSys/HelpSys.py    2007-11-02 11:27:15 UTC (rev 
81408)
@@ -219,21 +219,27 @@
     def __init__(self, id='Help', title=''):
         self.id=id
         self.title=title
-        c=self.catalog=ZCatalog('catalog')
-        # clear catalog
-        for index in c.indexes():
-            c.delIndex(index)
-        for col in c.schema():
-            c.delColumn(col)
-        c.addIndex('SearchableText', 'TextIndex')
-        c.addIndex('categories', 'KeywordIndex')
-        c.addIndex('permissions', 'KeywordIndex')
-        c.addColumn('categories')
-        c.addColumn('permissions')
-        c.addColumn('title_or_id')
-        c.addColumn('url')
-        c.addColumn('id')
+        self._catalog = None
 
+    @property
+    def catalog(self):
+        if self._catalog is None:
+            c=self._catalog=ZCatalog('catalog')
+            # clear catalog
+            for index in c.indexes():
+                c.delIndex(index)
+            for col in c.schema():
+                c.delColumn(col)
+            c.addIndex('SearchableText', 'TextIndex')
+            c.addIndex('categories', 'KeywordIndex')
+            c.addIndex('permissions', 'KeywordIndex')
+            c.addColumn('categories')
+            c.addColumn('permissions')
+            c.addColumn('title_or_id')
+            c.addColumn('url')
+            c.addColumn('id')
+        return self._catalog
+
     security.declareProtected(add_documents_images_and_files, 'addTopicForm')
     addTopicForm=DTMLFile('dtml/addTopic', globals())
 

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to