def request_version_approval(self, message): """Request approval for the current unapproved version Raises VersioningError, if there is no such version, or it is already approved. Returns None otherwise """ version_id = self.get_unapproved_version() if version_id is None: raise VersioningError(_("This content doesn't require approval."), self) version = self._getOb(version_id) status = IRequestForApprovalStatus(version) if status.pending: raise VersioningError( _('The version is already requested for approval.'), self) status.comment('request', message) notify(events.ContentRequestApprovalEvent(version, status))
def reject_version_approval(self, message): """Reject a previous request for approval Implementation should raise VersioningError, if the currently unapproved version has no request for approval yet, or if there is no unapproved version. """ version_id = self.get_unapproved_version() if version_id is None: raise VersioningError(_("This content doesn't require approval."), self) version = self._getOb(version_id) status = IRequestForApprovalStatus(version) if not status.pending: raise VersioningError( _("No request for approval is pending for this content."), self) status.comment('reject', message) notify(events.ContentApprovalRequestRefusedEvent(version, status))