diff options
| author | Robin Munn <robin.munn@gmail.com> | 2006-10-24 07:49:37 +0000 |
|---|---|---|
| committer | Robin Munn <robin.munn@gmail.com> | 2006-10-24 07:49:37 +0000 |
| commit | 0b059aa4eadc1d95ceca3a32821b65a9fb2a53e8 (patch) | |
| tree | 76f84c62e3ac5cd5172d43dd73a651bb8574e2d1 /django/core/validators.py | |
| parent | 1bb4fa2cb66269b1eff3b7d73f8c7864c0622368 (diff) | |
sqlalchemy: Merged revisions 3832 to 3917 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/sqlalchemy@3918 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core/validators.py')
| -rw-r--r-- | django/core/validators.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/core/validators.py b/django/core/validators.py index f2f3f44914..4c3f59143e 100644 --- a/django/core/validators.py +++ b/django/core/validators.py @@ -249,7 +249,7 @@ def hasNoProfanities(field_data, all_data): Watch your mouth! The words "f--k" and "s--t" are not allowed here. """ field_data = field_data.lower() # normalize - words_seen = [w for w in settings.PROFANITIES_LIST if field_data.find(w) > -1] + words_seen = [w for w in settings.PROFANITIES_LIST if w in field_data] if words_seen: from django.utils.text import get_text_list plural = len(words_seen) > 1 @@ -377,7 +377,7 @@ class IsValidFloat(object): if len(data) > max_allowed_length: raise ValidationError, ngettext("Please enter a valid decimal number with at most %s total digit.", "Please enter a valid decimal number with at most %s total digits.", self.max_digits) % self.max_digits - if (not '.' in data and len(data) > (max_allowed_length - self.decimal_places)) or ('.' in data and len(data) > (self.max_digits - (self.decimal_places - len(data.split('.')[1])) + 1)): + if (not '.' in data and len(data) > (max_allowed_length - self.decimal_places - 1)) or ('.' in data and len(data) > (max_allowed_length - (self.decimal_places - len(data.split('.')[1])))): raise ValidationError, ngettext( "Please enter a valid decimal number with a whole part of at most %s digit.", "Please enter a valid decimal number with a whole part of at most %s digits.", str(self.max_digits-self.decimal_places)) % str(self.max_digits-self.decimal_places) if '.' in data and len(data.split('.')[1]) > self.decimal_places: |
