--- a/src/pyams_content/component/association/container.py Tue Mar 06 16:55:05 2018 +0100
+++ b/src/pyams_content/component/association/container.py Wed Mar 07 09:48:42 2018 +0100
@@ -17,7 +17,7 @@
# import interfaces
from pyams_content.component.association.interfaces import IAssociationContainer, IAssociationTarget, \
- ASSOCIATION_CONTAINER_KEY, IAssociationInfo
+ ASSOCIATION_CONTAINER_KEY, IAssociationItem, IAssociationInfo
from pyams_content.features.checker.interfaces import IContentChecker
from zope.annotation.interfaces import IAnnotations
from zope.location.interfaces import ISublocations
@@ -56,6 +56,9 @@
# make sure that association item is correctly indexed
index_object(value)
+ def get_visible_items(self):
+ return filter(lambda x: IAssociationItem(x).visible, self.values())
+
@adapter_config(context=IAssociationTarget, provides=IAssociationContainer)
def association_container_factory(target):
--- a/src/pyams_content/component/association/interfaces/__init__.py Tue Mar 06 16:55:05 2018 +0100
+++ b/src/pyams_content/component/association/interfaces/__init__.py Wed Mar 07 09:48:42 2018 +0100
@@ -71,6 +71,9 @@
def append(self, value, notify=True):
"""Append given value to container"""
+ def get_visible_items(self):
+ """Get list of visible items"""
+
class IAssociationTarget(IAttributeAnnotatable):
"""Associations container target interface"""