Esempio n. 1
0
 def _process(self):
     form = AgreementForm()
     if form.validate_on_submit() and self.agreement.pending:
         reason = form.reason.data if form.agreed.data else None
         func = self.agreement.accept if form.agreed.data else self.agreement.reject
         func(from_ip=request.remote_addr, reason=reason)
         if self.agreement.definition.event_settings.get(self._conf, 'manager_notifications_enabled'):
             notify_new_signature_to_manager(self.agreement)
         return redirect(url_for('.agreement_form', self.agreement, uuid=self.agreement.uuid))
     html = self.agreement.render(form)
     return WPAgreementForm.render_string(html, self._conf)
Esempio n. 2
0
 def _process(self):
     form = AgreementForm()
     if form.validate_on_submit() and self.agreement.pending:
         reason = form.reason.data if form.agreed.data else None
         func = self.agreement.accept if form.agreed.data else self.agreement.reject
         func(from_ip=request.remote_addr, reason=reason)
         if self.agreement.definition.event_settings.get(self._conf, 'manager_notifications_enabled'):
             notify_new_signature_to_manager(self.agreement)
         return redirect(url_for('.agreement_form', self.agreement, uuid=self.agreement.uuid))
     html = self.agreement.render(form)
     return WPAgreementForm.render_string(html, self._conf)