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)
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))
def test_exclude_from_navigation_behavior(self): from plone.app.dexterity.behaviors.exclfromnav import IExcludeFromNavigation self.assertTrue(IExcludeFromNavigation.providedBy(self.journal))
def test_exclude_from_nav(self): self.assertTrue(IExcludeFromNavigation.providedBy(self.agenda))
def test_exclude_from_nav_behavior(self): self.assertFalse(IExcludeFromNavigation.providedBy(self.compromisso))
def test_exclude_from_navigation_behavior(self): self.assertTrue(IExcludeFromNavigation.providedBy(self.m1))
def test_behaviors(self): """Validate that the required behaviors are available.""" self.assertTrue(INameFromTitle.providedBy(self.ct)) self.assertTrue(IExcludeFromNavigation.providedBy(self.ct))
def test_can_be_excluded_from_navigation(self): self.assertTrue(IExcludeFromNavigation.providedBy(self.blog)) self.assertTrue(hasattr(self.blog, 'exclude_from_nav'))
def test_exclude_from_nav_behavior(self): self.assertFalse(IExcludeFromNavigation.providedBy(self.agendadiaria))
def test_exclude_from_navigation_behavior(self): from plone.app.dexterity.behaviors.exclfromnav import IExcludeFromNavigation self.assertTrue(IExcludeFromNavigation.providedBy(self.infographic))