From 7dc0cadc46d0d14f95de76f904068da50c0738f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 19 Mar 2020 16:57:50 +0100 Subject: [PATCH] Fix issue with Cerberus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cerberus has a clause `… and X in self.persisted_document`, which fails when `persisted_document` is `None` (which is the default value for the parameter). This code can be found in the function `_normalize_default()` in `.venv/lib/python3.6/site-packages/cerberus/validator.py:922`. --- pillar/api/organizations/patch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pillar/api/organizations/patch.py b/pillar/api/organizations/patch.py index 00a9563d..f23060f6 100644 --- a/pillar/api/organizations/patch.py +++ b/pillar/api/organizations/patch.py @@ -194,7 +194,7 @@ class OrganizationPatchHandler(patch_handler.AbstractPatchHandler): self.log.info('User %s edits Organization %s: %s', current_user_id, org_id, update) validator = current_app.validator_for_resource('organizations') - if not validator.validate_update(update, org_id): + if not validator.validate_update(update, org_id, persisted_document={}): resp = jsonify({ '_errors': validator.errors, '_message': ', '.join(f'{field}: {error}'