Skip to content

Commit

Permalink
Prettier.
Browse files Browse the repository at this point in the history
  • Loading branch information
calina-c committed Apr 13, 2023
1 parent 2e42052 commit d8104dd
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions ocean_provider/validation/provider_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,28 @@ 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()

if not hasattr(validator._processor, "signature_error_message"):
return messages

for overwritable_key in [
"signature",
"download_signature",
"decrypt_signature",
]:
if overwritable_key in messages:
messages[
overwritable_key
] = validator._processor.signature_error_message

return messages


class CustomValidator(Validator):
"""
Expand Down

0 comments on commit d8104dd

Please sign in to comment.