コード例 #1
0
def updateContainer(container, layout, ptypes):
    container.unindexObject()
    container.setLayout(layout)
    if IExcludeFromNavigation.providedBy(container):
        container.exclude_from_nav = True
    else:
        container.setExcludeFromNav(True)

    aspect = ISelectableConstrainTypes(container)
    addable = aspect.getImmediatelyAddableTypes()
    for ptype in ptypes:
        if ptype not in addable:
            aspect.setConstrainTypesMode(1)  # select manually
        if IDexterityContainer.providedBy(container):
            #bypass check for available types
            container.immediately_addable_types = ptypes
        else:
            aspect.setImmediatelyAddableTypes(ptypes)
コード例 #2
0
def updateHistoryContainer(obj):
    obj.unindexObject()
    obj.setLayout("collective_history_view")
    if IExcludeFromNavigation.providedBy(obj):
        obj.exclude_from_nav = True
    else:
        obj.setExcludeFromNav(True)

    aspect = ISelectableConstrainTypes(obj)
    addable = aspect.getImmediatelyAddableTypes()
    if "collective.history.useraction" not in addable:
        aspect.setConstrainTypesMode(1)  # select manually
        types = ["collective.history.useraction"]
        if IDexterityContainer.providedBy(obj):
            #bypass check for available types
            obj.immediately_addable_types = types
        else:
            aspect.setImmediatelyAddableTypes(types)
 def test_exclude_from_navigation_behavior(self):
     self.assertTrue(IExcludeFromNavigation.providedBy(self.office))
コード例 #4
0
 def test_exclude_from_navigation_behavior(self):
     from plone.app.dexterity.behaviors.exclfromnav import IExcludeFromNavigation
     self.assertTrue(IExcludeFromNavigation.providedBy(self.journal))
コード例 #5
0
 def test_exclude_from_nav(self):
     self.assertTrue(IExcludeFromNavigation.providedBy(self.agenda))
コード例 #6
0
 def test_exclude_from_nav_behavior(self):
     self.assertFalse(IExcludeFromNavigation.providedBy(self.compromisso))
コード例 #7
0
 def test_exclude_from_navigation_behavior(self):
     self.assertTrue(IExcludeFromNavigation.providedBy(self.m1))
コード例 #8
0
 def test_behaviors(self):
     """Validate that the required behaviors are available."""
     self.assertTrue(INameFromTitle.providedBy(self.ct))
     self.assertTrue(IExcludeFromNavigation.providedBy(self.ct))
コード例 #9
0
 def test_can_be_excluded_from_navigation(self):
     self.assertTrue(IExcludeFromNavigation.providedBy(self.blog))
     self.assertTrue(hasattr(self.blog, 'exclude_from_nav'))
コード例 #10
0
 def test_exclude_from_nav_behavior(self):
     self.assertFalse(IExcludeFromNavigation.providedBy(self.agendadiaria))
コード例 #11
0
 def test_exclude_from_nav_behavior(self):
     self.assertFalse(IExcludeFromNavigation.providedBy(self.agendadiaria))
コード例 #12
0
 def test_exclude_from_navigation_behavior(self):
     from plone.app.dexterity.behaviors.exclfromnav import IExcludeFromNavigation
     self.assertTrue(IExcludeFromNavigation.providedBy(self.infographic))
コード例 #13
0
 def test_exclude_from_nav_behavior(self):
     self.assertFalse(IExcludeFromNavigation.providedBy(self.compromisso))
コード例 #14
0
 def test_exclude_from_nav(self):
     self.assertTrue(IExcludeFromNavigation.providedBy(self.agenda))