Update of /cvs-repository/Products/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv10026

Modified Files:
        CMFCatalogAware.py 
Log Message:
Add an optional argument that permits to prevent self to be reindexed but only 
its descendants. This is really useful when you wanna optimize your indexation 
mecanism in certain situations. For instance, when you need to reindex *all* 
the idxs *and* the security* for a given object.


=== Products/CMFCore/CMFCatalogAware.py 1.27 => 1.28 ===
--- Products/CMFCore/CMFCatalogAware.py:1.27    Fri Apr 22 12:18:37 2005
+++ Products/CMFCore/CMFCatalogAware.py Fri Apr 22 12:46:34 2005
@@ -76,7 +76,7 @@
             catalog.reindexObject(self, idxs=idxs)
 
     security.declareProtected(ModifyPortalContent, 'reindexObjectSecurity')
-    def reindexObjectSecurity(self):
+    def reindexObjectSecurity(self, skip_self=False):
         """
             Reindex security-related indexes on the object
             (and its descendants).
@@ -98,10 +98,11 @@
                 catalog.reindexObject(ob, idxs=['allowedRolesAndUsers'],
                                       update_metadata=0)
                 if s is None: ob._p_deactivate()
-            # Reindex the object itself, as the PathIndex only gave us
-            # the descendants.
-            catalog.reindexObject(self, idxs=['allowedRolesAndUsers'],
-                                  update_metadata=0)
+            # Reindex the object itself in here if not explicitly
+            # asked to not to
+            if not skip_self:
+                catalog.reindexObject(self, idxs=['allowedRolesAndUsers'],
+                                      update_metadata=0)
 
     # Workflow methods
     # ----------------

_______________________________________________
CMF-checkins mailing list
[email protected]
http://mail.zope.org/mailman/listinfo/cmf-checkins

Reply via email to