Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotEmptyValidator minimal logging #39

Closed
gregorkschroeder opened this issue Sep 18, 2017 · 2 comments
Closed

NotEmptyValidator minimal logging #39

gregorkschroeder opened this issue Sep 18, 2017 · 2 comments

Comments

@gregorkschroeder
Copy link

NotEmptyValidator always returns an empty set for it's bad property regardless of failure causing the Vlad class to return False and log the general "Failed :(" message without an indication of the field that failed or the times it failed. Solution proposed below avoids repetition of empty strings in logger output while providing logging on par with the other Validators.

class NotEmptyValidator(Validator):
    ''' Validates that a field is not empty '''

    def __init__(self):
        self.fail_count = 0
        self.empty = set([])

    def validate(self, field, row={}):
        if field == '':
            self.empty.add(field)
            raise ValidationException("Row has empty field in column")

    @property
    def bad(self):
        return self.empty
@gregorkschroeder gregorkschroeder changed the title NotEmptyValidator has no field logging NotEmptyValidator minimal logging Sep 18, 2017
@di di closed this as completed in #40 Sep 18, 2017
@di
Copy link
Owner

di commented Sep 18, 2017

Nice catch, thanks @gregorkschroeder!

@gregorkschroeder
Copy link
Author

Thanks for this great utility!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants