def submit(self, form_model, values, reporter_names, is_update=False): try: form_model.bind(values) cleaned_data, errors = form_model.validate_submission(values=values) handler = handler_factory(self.dbm, form_model, is_update) response = handler.handle(form_model, cleaned_data, errors, reporter_names, self.location_tree) return response except MangroveException: raise
def _submit_subject(self, form_model, values, location_tree): try: values = RegistrationWorkFlow(self.dbm, form_model, location_tree).process(values) form_model.bind(values) cleaned_data, errors = form_model.validate_submission( values=values) handler = handler_factory(self.dbm, form_model) response = handler.handle(form_model, cleaned_data, errors, [], location_tree) return response except MangroveException: raise
def test_should_get_submission_handler_for_all_other_form_models(self): self.form_model.form_code = None self.assertIsInstance(handler_factory(self.dbm, self.form_model), CreateEntityHandler)
def test_should_get_delete_handler_for_delete_form_model(self): self.assertIsInstance(handler_factory(self.dbm, self.form_model), DeleteHandler)