def __call__(self): """Perform the toggle.""" msg_type = 'info' if ILocalMLSSettings.providedBy(self.context): # Deactivate local MLS settings. noLongerProvides(self.context, ILocalMLSSettings) self.context.reindexObject(idxs=[ 'object_provides', ]) msg = _(u'Local MLS settings deactivated.') elif IPossibleLocalMLSSettings.providedBy(self.context): alsoProvides(self.context, ILocalMLSSettings) self.context.reindexObject(idxs=[ 'object_provides', ]) msg = _(u'Local MLS settings activated.') else: msg = _(u'The local MLS settings don\'t work with this ' u'content type. Add \'IPossibleLocalMLSSettings\' to the ' u'provided interfaces to enable this feature.') msg_type = 'error' self.context.plone_utils.addPortalMessage(msg, msg_type) self.request.response.redirect(self.context.absolute_url())
def __call__(self): """Perform the toggle.""" msg_type = 'info' if ILocalMLSSettings.providedBy(self.context): # Deactivate local MLS settings. noLongerProvides(self.context, ILocalMLSSettings) self.context.reindexObject(idxs=['object_provides', ]) msg = _(u'Local MLS settings deactivated.') elif IPossibleLocalMLSSettings.providedBy(self.context): alsoProvides(self.context, ILocalMLSSettings) self.context.reindexObject(idxs=['object_provides', ]) msg = _(u'Local MLS settings activated.') else: msg = _( u'The local MLS settings don\'t work with this ' u'content type. Add \'IPossibleLocalMLSSettings\' to the ' u'provided interfaces to enable this feature.' ) msg_type = 'error' self.context.plone_utils.addPortalMessage(msg, msg_type) self.request.response.redirect(self.context.absolute_url())
def can_activate(self): """Can the local MLS configuration be activated for this context?""" return IPossibleLocalMLSSettings.providedBy(self.context) and \ not ILocalMLSSettings.providedBy(self.context)
def can_activate(self): """Can the local MLS configuration be activated for this context?""" return IPossibleLocalMLSSettings.providedBy(self.context) and \ not ILocalMLSSettings.providedBy(self.context)