class UnlockForm(form.Form): label = _(u"Unlock this structural content object") description = _( u"To unlock this 'Structural content' object click on 'Save'. " "Remember that this could generate inconsistencies in the portal. " "If you are unsure about this action click on 'Cancel'.") @button.buttonAndHandler(_(u"Save")) def handleApply(self, action): plone_utils = getToolByName(self.context, "plone_utils") if not IStructuralContent.providedBy(self.context): plone_utils.addPortalMessage(_("This object is not locked"), "error") self.request.response.redirect(self.context.absolute_url()) return lock.unlockContext(self.context) noLongerProvides(self.context, IStructuralContent) self.context.reindexObject(idxs=["object_provides"]) plone_utils.addPortalMessage( _(u"The object was unlocked and can now could be modified")) self.request.response.redirect(self.context.absolute_url()) @button.buttonAndHandler(_(u"Cancel")) def handleCancel(self, action): plone_utils = getToolByName(self.context, "plone_utils") plone_utils.addPortalMessage(_("Accion cancelled")) self.request.response.redirect(self.context.absolute_url())
def handleApply(self, action): plone_utils = getToolByName(self.context, "plone_utils") if not IStructuralContent.providedBy(self.context): plone_utils.addPortalMessage(_("This object is not locked"), "error") self.request.response.redirect(self.context.absolute_url()) return lock.unlockContext(self.context) noLongerProvides(self.context, IStructuralContent) self.context.reindexObject(idxs=["object_provides"]) plone_utils.addPortalMessage( _(u"The object was unlocked and can now could be modified")) self.request.response.redirect(self.context.absolute_url())
def handleApply(self, action): lock.lockContext(self.context) alsoProvides(self.context, IStructuralContent) self.context.reindexObject(idxs=["object_provides"]) plone_utils = getToolByName(self.context, "plone_utils") plone_utils.addPortalMessage( _(u"The content was locked as 'Structual content'")) self.request.response.redirect(self.context.absolute_url())
class LockForm(form.Form): label = _(u"Lock this object as 'Structural content'") description = _( u"To lock this object as 'Structural content' click on 'Save'. " "If you are unsure about this action click on 'Cancel'.") @button.buttonAndHandler(_(u"Save")) def handleApply(self, action): lock.lockContext(self.context) alsoProvides(self.context, IStructuralContent) self.context.reindexObject(idxs=["object_provides"]) plone_utils = getToolByName(self.context, "plone_utils") plone_utils.addPortalMessage( _(u"The content was locked as 'Structual content'")) self.request.response.redirect(self.context.absolute_url()) @button.buttonAndHandler(_(u"Cancel")) def handleCancel(self, action): plone_utils = getToolByName(self.context, "plone_utils") plone_utils.addPortalMessage(_("Accion cancelled")) self.request.response.redirect(self.context.absolute_url())
def handleCancel(self, action): plone_utils = getToolByName(self.context, "plone_utils") plone_utils.addPortalMessage(_("Accion cancelled")) self.request.response.redirect(self.context.absolute_url())