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): """