From 429b9a8ce6971d8d547ea8be6f8234ed4d82673c Mon Sep 17 00:00:00 2001 From: peterfarrell Date: Thu, 25 Oct 2018 12:31:33 -0400 Subject: [PATCH] * Removed dead code (remove_validators and RemoveMaxLengthValidatorMixin) * Bumped to v2.5.1 --- CHANGELOG.md | 1 + pgcrypto/mixins.py | 14 -------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c0d8a0..673ffa4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/pgcrypto/mixins.py b/pgcrypto/mixins.py index a9556b4..8d4e897 100644 --- a/pgcrypto/mixins.py +++ b/pgcrypto/mixins.py @@ -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 @@ -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: @@ -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)