mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-21 14:59:26 -04:00
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:
@@ -79,7 +79,7 @@ def cancel_letter_job(service_id, job_id):
|
||||
|
||||
@job_blueprint.route('/<job_id>/notifications', methods=['GET'])
|
||||
def get_all_notifications_for_service_job(service_id, job_id):
|
||||
data = notifications_filter_schema.load(request.args).data
|
||||
data = notifications_filter_schema.load(request.args)
|
||||
page = data['page'] if 'page' in data else 1
|
||||
page_size = data['page_size'] if 'page_size' in data else current_app.config.get('PAGE_SIZE')
|
||||
paginated_notifications = get_notifications_for_job(
|
||||
@@ -173,7 +173,7 @@ def create_job(service_id):
|
||||
|
||||
data.update({"template_version": template.version})
|
||||
|
||||
job = job_schema.load(data).data
|
||||
job = job_schema.load(data)
|
||||
|
||||
if job.scheduled_for:
|
||||
job.job_status = JOB_STATUS_SCHEDULED
|
||||
|
||||
Reference in New Issue
Block a user