From 6f29347c2e8889047195211e8b83ee67ba163c77 Mon Sep 17 00:00:00 2001 From: Calina Cenan Date: Thu, 13 Apr 2023 06:47:30 +0000 Subject: [PATCH] Prettier. --- .../validation/provider_requests.py | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/ocean_provider/validation/provider_requests.py b/ocean_provider/validation/provider_requests.py index 438eaa3aa..81dd33290 100644 --- a/ocean_provider/validation/provider_requests.py +++ b/ocean_provider/validation/provider_requests.py @@ -54,21 +54,26 @@ def __init__(self, request=None): def validate(self): for validator in self._validators: if validator.fails(): - messages = validator.messages() - for overwritable_key in [ - "signature", - "download_signature", - "decrypt_signature", - ]: - if overwritable_key in messages and hasattr( - validator._processor, "signature_error_message" - ): - messages[ - overwritable_key - ] = validator._processor.signature_error_message + messages = self.overwrite_messages(validator) raise ValidationException(messages) return True + def overwrite_messages(self, validator): + messages = validator.messages() + for overwritable_key in [ + "signature", + "download_signature", + "decrypt_signature", + ]: + if overwritable_key in messages and hasattr( + validator._processor, "signature_error_message" + ): + messages[ + overwritable_key + ] = validator._processor.signature_error_message + + return messages + class CustomValidator(Validator): """