Skip to content

Commit

Permalink
Fix pylint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
moshthepitt committed Mar 6, 2019
1 parent 425d583 commit 7f86090
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions vega_admin/contrib/users/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
UNIQUE_EMAIL = app_settings.UNIQUE_EMAIL # pylint: disable=no-member


def validate_unique_email(value):
"""Validate unique email when editting users"""
try:
return get_adapter().validate_unique_email(email=value)
except NameError:
return value


class UserFormMixin: # pylint: disable=too-few-public-methods
"""User forms mixin"""

Expand All @@ -33,7 +41,7 @@ def clean_email(self):
except NameError:
pass
if value and UNIQUE_EMAIL:
value = self.validate_unique_email(value)
value = validate_unique_email(value)
return value


Expand Down Expand Up @@ -164,13 +172,6 @@ def __init__(self, *args, **kwargs):
cancel_url=self.vega_extra_kwargs.get("cancel_url", "/")),
)

def validate_unique_email(self, value):
"""Validate unique email when editting users"""
try:
return get_adapter().validate_unique_email(email=value)
except NameError:
return value


class PasswordChangeForm(AdminPasswordChangeForm):
"""Custom form for admins to change user passwords"""
Expand Down

0 comments on commit 7f86090

Please sign in to comment.