[Checkins] SVN: Products.CMFCore/trunk/Products/CMFCore/ - added ICatalogAware interface for CMFCatalogAware methods

Yvo Schubbe y.2007- at wcm-solutions.de
Wed Dec 26 08:49:27 EST 2007


Log message for revision 82448:
  - added ICatalogAware interface for CMFCatalogAware methods

Changed:
  U   Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt
  U   Products.CMFCore/trunk/Products/CMFCore/CMFCatalogAware.py
  U   Products.CMFCore/trunk/Products/CMFCore/PortalFolder.py
  U   Products.CMFCore/trunk/Products/CMFCore/interfaces/_content.py
  U   Products.CMFCore/trunk/Products/CMFCore/testing.py

-=-
Modified: Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt	2007-12-26 10:12:03 UTC (rev 82447)
+++ Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt	2007-12-26 13:49:26 UTC (rev 82448)
@@ -2,6 +2,8 @@
 
   Products.CMFCore 2.2.0 (unreleased)
 
+    - interfaces: Added ICatalogAware for CMFCatalogAware methods.
+
     - setup handlers: All import and export steps are now registered globally.
 
     - MembershipTool: Removed ancient LoginManager compatibility code and

Modified: Products.CMFCore/trunk/Products/CMFCore/CMFCatalogAware.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/CMFCatalogAware.py	2007-12-26 10:12:03 UTC (rev 82447)
+++ Products.CMFCore/trunk/Products/CMFCore/CMFCatalogAware.py	2007-12-26 13:49:26 UTC (rev 82448)
@@ -27,8 +27,10 @@
 from zope.app.container.interfaces import IObjectAddedEvent
 from zope.app.container.interfaces import IObjectMovedEvent
 from zope.component import subscribers
+from zope.interface import implements
 
 from interfaces import ICallableOpaqueItem
+from interfaces import ICatalogAware
 from permissions import AccessContentsInformation
 from permissions import ManagePortal
 from permissions import ModifyPortalContent
@@ -44,6 +46,8 @@
     """Mix-in for notifying portal_catalog and portal_workflow
     """
 
+    implements(ICatalogAware)
+
     security = ClassSecurityInfo()
 
     # The following methods can be overriden using inheritence so that
@@ -56,37 +60,29 @@
     def _getWorkflowTool(self):
         return getToolByName(self, 'portal_workflow', None)
 
-    # Cataloging methods
-    # ------------------
-
+    #
+    #   'ICatalogAware' interface methods
+    #
     security.declareProtected(ModifyPortalContent, 'indexObject')
     def indexObject(self):
+        """ Index the object in the portal catalog.
         """
-            Index the object in the portal catalog.
-        """
         catalog = self._getCatalogTool()
         if catalog is not None:
             catalog.indexObject(self)
 
     security.declareProtected(ModifyPortalContent, 'unindexObject')
     def unindexObject(self):
+        """ Unindex the object from the portal catalog.
         """
-            Unindex the object from the portal catalog.
-        """
         catalog = self._getCatalogTool()
         if catalog is not None:
             catalog.unindexObject(self)
 
     security.declareProtected(ModifyPortalContent, 'reindexObject')
     def reindexObject(self, idxs=[]):
+        """ Reindex the object in the portal catalog.
         """
-            Reindex the object in the portal catalog.
-            If idxs is present, only those indexes are reindexed.
-            The metadata is always updated.
-
-            Also update the modification date of the object,
-            unless specific indexes were requested.
-        """
         if idxs == []:
             # Update the modification date.
             if hasattr(aq_base(self), 'notifyModified'):
@@ -99,13 +95,7 @@
 
     security.declareProtected(ModifyPortalContent, 'reindexObjectSecurity')
     def reindexObjectSecurity(self, skip_self=False):
-        """Reindex security-related indexes on the object.
-
-        Recurses in the children to reindex them too.
-
-        If skip_self is True, only the children will be reindexed. This
-        is a useful optimization if the object itself has just been
-        fully reindexed, as there's no need to reindex its security twice.
+        """ Reindex security-related indexes on the object.
         """
         catalog = self._getCatalogTool()
         if catalog is None:
@@ -133,9 +123,6 @@
                                   update_metadata=0, uid=brain_path)
             if s is None: ob._p_deactivate()
 
-    # Workflow methods
-    # ----------------
-
     security.declarePrivate('notifyWorkflowCreated')
     def notifyWorkflowCreated(self):
         """

Modified: Products.CMFCore/trunk/Products/CMFCore/PortalFolder.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/PortalFolder.py	2007-12-26 10:12:03 UTC (rev 82447)
+++ Products.CMFCore/trunk/Products/CMFCore/PortalFolder.py	2007-12-26 13:49:26 UTC (rev 82448)
@@ -272,7 +272,7 @@
     def reindexObject(self, idxs=[]):
         pass
 
-    def reindexObjectSecurity(self):
+    def reindexObjectSecurity(self, skip_self=False):
         pass
 
     def PUT_factory( self, name, typ, body ):

Modified: Products.CMFCore/trunk/Products/CMFCore/interfaces/_content.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/interfaces/_content.py	2007-12-26 10:12:03 UTC (rev 82447)
+++ Products.CMFCore/trunk/Products/CMFCore/interfaces/_content.py	2007-12-26 13:49:26 UTC (rev 82448)
@@ -516,6 +516,44 @@
         """
 
 
+class ICatalogAware(Interface):
+
+    """ Interface for notifying portal_catalog and portal_workflow.
+    """
+
+    def indexObject():
+        """ Index the object in the portal catalog.
+        """
+
+    def unindexObject():
+        """ Unindex the object from the portal catalog.
+        """
+
+    def reindexObject(idxs=[]):
+        """ Reindex the object in the portal catalog.
+
+        If idxs is present, only those indexes are reindexed. The metadata is
+        always updated.
+
+        Also update the modification date of the object, unless specific
+        indexes were requested.
+        """
+
+    def reindexObjectSecurity(skip_self=False):
+        """ Reindex security-related indexes on the object.
+
+        Recurses in the children to reindex them too.
+
+        If skip_self is True, only the children will be reindexed. This is a
+        useful optimization if the object itself has just been fully
+        reindexed, as there's no need to reindex its security twice.
+        """
+
+    def notifyWorkflowCreated():
+        """ Notify the workflow that the object was just created.
+        """
+
+
 #
 #   Folderish interfaces
 #

Modified: Products.CMFCore/trunk/Products/CMFCore/testing.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/testing.py	2007-12-26 10:12:03 UTC (rev 82447)
+++ Products.CMFCore/trunk/Products/CMFCore/testing.py	2007-12-26 13:49:26 UTC (rev 82448)
@@ -34,10 +34,12 @@
 
     def test_folder_interfaces(self):
         from webdav.interfaces import IWriteLock
+        from Products.CMFCore.interfaces import ICatalogAware
         from Products.CMFCore.interfaces import IDynamicType
         from Products.CMFCore.interfaces import IFolderish
         from Products.CMFCore.interfaces import IMutableMinimalDublinCore
 
+        verifyClass(ICatalogAware, self._getTargetClass())
         verifyClass(IDynamicType, self._getTargetClass())
         verifyClass(IFolderish, self._getTargetClass())
         verifyClass(IMutableMinimalDublinCore, self._getTargetClass())
@@ -48,6 +50,7 @@
 
     def test_content_interfaces(self):
         from Products.CMFCore.interfaces import ICatalogableDublinCore
+        from Products.CMFCore.interfaces import ICatalogAware
         from Products.CMFCore.interfaces import IContentish
         from Products.CMFCore.interfaces import IDublinCore
         from Products.CMFCore.interfaces import IDynamicType
@@ -55,6 +58,7 @@
         from Products.GenericSetup.interfaces import IDAVAware
 
         verifyClass(ICatalogableDublinCore, self._getTargetClass())
+        verifyClass(ICatalogAware, self._getTargetClass())
         verifyClass(IContentish, self._getTargetClass())
         verifyClass(IDAVAware, self._getTargetClass())
         verifyClass(IDublinCore, self._getTargetClass())



More information about the Checkins mailing list