src/pyams_content/component/association/container.py
changeset 445 ad73bd24079f
parent 256 8e2207197a9a
child 548 43048fb84b87
equal deleted inserted replaced
444:a20522cd41f6 445:ad73bd24079f
    15 
    15 
    16 # import standard library
    16 # import standard library
    17 
    17 
    18 # import interfaces
    18 # import interfaces
    19 from pyams_content.component.association.interfaces import IAssociationContainer, IAssociationTarget, \
    19 from pyams_content.component.association.interfaces import IAssociationContainer, IAssociationTarget, \
    20     ASSOCIATION_CONTAINER_KEY, IAssociationInfo
    20     ASSOCIATION_CONTAINER_KEY, IAssociationItem, IAssociationInfo
    21 from pyams_content.features.checker.interfaces import IContentChecker
    21 from pyams_content.features.checker.interfaces import IContentChecker
    22 from zope.annotation.interfaces import IAnnotations
    22 from zope.annotation.interfaces import IAnnotations
    23 from zope.location.interfaces import ISublocations
    23 from zope.location.interfaces import ISublocations
    24 from zope.traversing.interfaces import ITraversable
    24 from zope.traversing.interfaces import ITraversable
    25 
    25 
    53         self[key] = value
    53         self[key] = value
    54         self.last_id += 1
    54         self.last_id += 1
    55         if not notify:
    55         if not notify:
    56             # make sure that association item is correctly indexed
    56             # make sure that association item is correctly indexed
    57             index_object(value)
    57             index_object(value)
       
    58 
       
    59     def get_visible_items(self):
       
    60         return filter(lambda x: IAssociationItem(x).visible, self.values())
    58 
    61 
    59 
    62 
    60 @adapter_config(context=IAssociationTarget, provides=IAssociationContainer)
    63 @adapter_config(context=IAssociationTarget, provides=IAssociationContainer)
    61 def association_container_factory(target):
    64 def association_container_factory(target):
    62     """Associations container factory"""
    65     """Associations container factory"""