From 19f125f5428bf64bcc64e2e241b9ae3e6b778a79 Mon Sep 17 00:00:00 2001 From: David Kilias Date: Tue, 20 Apr 2021 22:39:12 +0200 Subject: [PATCH] fix formatting --- entity_validator.py | 47 +++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/entity_validator.py b/entity_validator.py index 6bbb497..103b8b6 100644 --- a/entity_validator.py +++ b/entity_validator.py @@ -3,77 +3,78 @@ from cerberus import Validator from validation_functions import * + def validate(entity): - schema_fin={ + schema_fin = { 'bic': { - 'type': 'string', + 'type': 'string', 'required': True, 'check_with': valid_bic}, 'iban': { - 'type': 'string', + 'type': 'string', 'required': True, 'check_with': valid_iban}, 'issuance': { - 'type': 'string', + 'type': 'string', 'required': True, 'check_with': iso_date}, 'reference': {'type': 'string'}, 'scan-sepa-mandate': {'type': 'string'}, 'holder': {'type': 'string'}} - schema_membership={ + schema_membership = { 'bis': { 'type': 'string', - 'oneof': [{'check_with': iso_date},{'empty': True}]}, + 'oneof': [{'check_with': iso_date}, {'empty': True}]}, 'mitgliedsbeitrag': { - 'type': 'string', + 'type': 'string', 'check_with': valid_money_amount}, - 'scan-antrag': {'type': 'string'}, + 'scan-antrag': {'type': 'string'}, 'schliessberechtigung': { 'type': 'string', - 'allowed': ['Ja', 'Nein', 'J', 'N', 'j', 'n', 'y', 'Y']}, + 'allowed': ['Ja', 'Nein', 'J', 'N', 'j', 'n', 'y', 'Y']}, 'spendenbeitrag': { 'type': 'string', - 'check_with': valid_money_amount}, + 'check_with': valid_money_amount}, 'status': { 'type': 'string', 'required': True, - 'allowed': ['V', 'E', 'F']}, + 'allowed': ['V', 'E', 'F']}, 'von': { 'type': 'string', 'required': True, 'check_with': iso_date}} - schema_base={ + schema_base = { 'address_code': { - 'type': 'string'}, + 'type': 'string'}, 'address_country': { - 'type': 'string'}, + 'type': 'string'}, 'address_label': { - 'type': 'string'}, + 'type': 'string'}, 'address_locality': { - 'type': 'string'}, + 'type': 'string'}, 'address_region': { - 'type': 'string'}, + 'type': 'string'}, 'address_street': { 'type': 'string'}, 'birth_date': { 'type': 'string', 'required': True, - 'check_with': iso_date}, + 'check_with': iso_date}, 'birth_location': { 'type': 'string'}, 'email': { 'type': 'string', 'required': True, - 'check_with': valid_email}, + 'check_with': valid_email}, 'fullname': { 'type': 'string', 'required': True}, 'nickname': { - 'type': 'string'}, + 'type': 'string'}, 'pgp-key': { - 'type': 'string'}, + 'type': 'string'}, 'ssh-key': { 'type': 'string'}} @@ -102,5 +103,5 @@ def validate(entity): v = Validator() result = { 'valid': v.validate(entity, schema), - 'errors': v.errors} - return result \ No newline at end of file + 'errors': v.errors} + return result