[CMF-checkins] CVS: Products/CMFCore - CMFCatalogAware.py:1.21.2.10

Julien Anguenot ja at nuxeo.com
Sun Apr 24 20:40:12 EDT 2005


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

Modified Files:
      Tag: CMF-1_5-branch
	CMFCatalogAware.py 
Log Message:
CMFCatalogAware: reindexObjectSecurity() now supports an
optional argument 'skip_self' that prevents the object itself
from being reindexed, but its descendants still are. Allows an
optimization when you want to reindex all the idxs *and* the
security in a single shot with reindexObject()


=== Products/CMFCore/CMFCatalogAware.py 1.21.2.9 => 1.21.2.10 ===
--- Products/CMFCore/CMFCatalogAware.py:1.21.2.9	Fri Apr 22 14:50:32 2005
+++ Products/CMFCore/CMFCatalogAware.py	Sun Apr 24 20:40:11 2005
@@ -77,7 +77,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).
@@ -106,10 +106,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
     # ----------------



More information about the CMF-checkins mailing list