Skip to content

Commit

Permalink
* Removed dead code (remove_validators and RemoveMaxLengthValidatorMi…
Browse files Browse the repository at this point in the history
…xin)

* Bumped to v2.5.1
  • Loading branch information
peterfarrell committed Oct 25, 2018
1 parent 014efdf commit 429b9a8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# 2.5.1

* Fixed regression in the definition of EmailPGPPublicKeyField (#77)
* Removed dead code (remove_validators and RemoveMaxLengthValidatorMixin)

## 2.5.0

Expand Down
14 changes: 0 additions & 14 deletions pgcrypto/mixins.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.conf import settings
from django.core.validators import MaxLengthValidator
from django.db.models.expressions import Col
from django.utils.functional import cached_property

Expand All @@ -11,11 +10,6 @@
)


def remove_validators(validators, validator_class):
"""Exclude `validator_class` instances from `validators` list."""
return [v for v in validators if not isinstance(v, validator_class)]


def get_setting(connection, key):
"""Get key from connection or default to settings."""
if key in connection.settings_dict:
Expand Down Expand Up @@ -171,11 +165,3 @@ def get_cast_sql(self):
'max_digits': self.max_digits,
'decimal_places': self.decimal_places
}


class RemoveMaxLengthValidatorMixin:
"""Exclude `MaxLengthValidator` from field validators."""
def __init__(self, *args, **kwargs):
"""Remove `MaxLengthValidator` in parent's `.__init__`."""
super().__init__(*args, **kwargs)
self.validators = remove_validators(self.validators, MaxLengthValidator)

0 comments on commit 429b9a8

Please sign in to comment.