def _get_relation_to_baseline(self): # do we have a baseline in our relations? relations = get_relations(self.context) if relations and not len(relations) == 1: raise CheckinException('Baseline count mismatch') if not relations or not relations[0]: raise CheckinException('Baseline has disappeared') return relations[0]
def _getBaseline(self): # follow the working copy's reference back to the baseline refs = self.context.getRefs(WorkingCopyRelation.relationship) if not len(refs) == 1: raise CheckinException('Baseline count mismatch') if not refs or refs[0] is None: raise CheckinException('Baseline has disappeared') baseline = refs[0] return baseline
def __call__(self): context = aq_inner(self.context) if 'form.button.Checkin' in self.request.form: control = getMultiAdapter((context, self.request), name=u'iterate_control') if not control.checkin_allowed(): raise CheckinException(u'Not a checkout') message = self.request.form.get('checkin_message', '') policy = ICheckinCheckoutPolicy(context) baseline = policy.checkin(message) IStatusMessage(self.request).addStatusMessage(_('Checked in'), type='info') view_url = baseline.restrictedTraverse( '@@plone_context_state').view_url() self.request.response.redirect(view_url) elif 'form.button.Cancel' in self.request.form: view_url = context.restrictedTraverse( '@@plone_context_state').view_url() self.request.response.redirect(view_url) else: return self.index()
def _getBaseline(self): baseline = get_baseline(self.context) if not baseline: raise CheckinException('Baseline has disappeared') return baseline