[CMF-checkins] SVN: CMF/branches/opaque_item_events/CMFCore/CMFCatalogAware.py - merged left-overs from tseaver-catalog_events branch (this code fragment might still be useful)

Yvo Schubbe y.2006_ at wcm-solutions.de
Fri May 19 04:03:21 EDT 2006


Log message for revision 68184:
  - merged left-overs from tseaver-catalog_events branch (this code fragment might still be useful)

Changed:
  U   CMF/branches/opaque_item_events/CMFCore/CMFCatalogAware.py

-=-
Modified: CMF/branches/opaque_item_events/CMFCore/CMFCatalogAware.py
===================================================================
--- CMF/branches/opaque_item_events/CMFCore/CMFCatalogAware.py	2006-05-19 07:45:36 UTC (rev 68183)
+++ CMF/branches/opaque_item_events/CMFCore/CMFCatalogAware.py	2006-05-19 08:03:21 UTC (rev 68184)
@@ -26,6 +26,9 @@
 from OFS.interfaces import IObjectWillBeMovedEvent
 from zope.app.container.interfaces import IObjectAddedEvent
 from zope.app.container.interfaces import IObjectMovedEvent
+from zope.app.location.interfaces import ISublocations
+from zope.component import adapts
+from zope.interface import implements
 
 from permissions import AccessContentsInformation
 from permissions import ManagePortal
@@ -35,6 +38,7 @@
 from utils import getToolByName
 
 from interfaces import ICallableOpaqueItem
+from interfaces import IContentish
 from interfaces.IOpaqueItems \
         import ICallableOpaqueItem as z2ICallableOpaqueItem
 
@@ -266,6 +270,28 @@
 InitializeClass(CMFCatalogAware)
 
 
+class ContentishSublocations(object):
+
+    """ Get the sublocations for content, including "opaque" subitems.
+    """
+    adapts(IContentish)
+    implements(ISublocations)
+
+    def __init__(self, context):
+        self.context = context
+
+    def sublocations(self):
+
+        for ob in self.context.objectValues():
+            yield ob
+
+        for opaque in  self.context.opaqueValues():
+            s = getattr(opaque, '_p_changed', 0)
+            yield opaque
+            if s is None:
+                opaque._p_deactivate()
+
+
 def handleObjectEvent(ob, event):
     """ Event subscriber for (IContentish, IObjectEvent) events.
 



More information about the CMF-checkins mailing list