Replace how .load is called

https://marshmallow.readthedocs.io/en/stable/upgrading.html#schemas-are-always-strict

`.load` doesn't return a `(data, errors)` tuple any more - only data is
returned. A `ValidationError` is raised if validation fails. The code
now relies on the `marshmallow_validation_error` error handler to handle
errors instead of having to raise an `InvalidRequest`. This has no
effect on the response that is returned (a test has been modified to
check).

Also added a new `password` field to the `UserSchema` so that we don't
have to specially check for password errors in the `.create_user` endpoint
- we can let marshmallow handle them.
This commit is contained in:
Katie Smith
2022-05-06 15:25:14 +01:00
parent 906165eeb5
commit bd4f74b359
10 changed files with 37 additions and 40 deletions

View File

@@ -156,7 +156,7 @@ def update_template(service_id, template_id):
errors = {'content': [message]}
raise InvalidRequest(errors, status_code=400)
update_dict = template_schema.load(updated_template).data
update_dict = template_schema.load(updated_template)
if update_dict.archived:
update_dict.folder = None
dao_update_template(update_dict)