def handle_autopublish(self): form = self.request.form obj = self.context changed = False if form.get('enable'): if not IAutoPublishable.providedBy(obj): alsoProvides(obj, IAutoPublishable) msg = _('Auto-publish enabled') changed = True else: if IAutoPublishable.providedBy(obj): noLongerProvides(obj, IAutoPublishable) msg = _('Auto-publish disabled') changed = True if changed: obj.reindexObject(idxs=['object_provides']) self.update_message(msg)
def auto_publish_enabled(self): return IAutoPublishable.providedBy(self.context)