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

Julien Anguenot ja at nuxeo.com
Fri Apr 22 12:48:54 EDT 2005


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

Modified Files:
      Tag: CMF-1_5-branch
	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.21.2.6 => 1.21.2.7 ===
--- Products/CMFCore/CMFCatalogAware.py:1.21.2.6	Fri Apr 22 12:23:21 2005
+++ Products/CMFCore/CMFCatalogAware.py	Fri Apr 22 12:48:54 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
     # ----------------



More information about the CMF-checkins mailing list