diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-09-25 17:38:35 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-09-25 17:38:35 +0000 |
| commit | 321a59a36a545cc90000e1661ba0ed145585eea9 (patch) | |
| tree | 2923853eef06b66b6f05c86e9539e1aa1d3bc7cc | |
| parent | 61a1a1864d6e5aff91b87a57e76765000f910daa (diff) | |
Small improvements to profanities-to-settings move from [3784]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3837 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/conf/global_settings.py | 4 | ||||
| -rw-r--r-- | django/core/validators.py | 2 | ||||
| -rw-r--r-- | docs/settings.txt | 7 |
3 files changed, 8 insertions, 5 deletions
diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py index dc30d3f1f4..11b1c0e08a 100644 --- a/django/conf/global_settings.py +++ b/django/conf/global_settings.py @@ -274,8 +274,8 @@ CACHE_MIDDLEWARE_KEY_PREFIX = '' COMMENTS_ALLOW_PROFANITIES = False # The profanities that will trigger a validation error in the -# 'hasNoProfanities' validator. All of these should be in lower-case. -PROFANITIES_LIST = ['asshat', 'asshead', 'asshole', 'cunt', 'fuck', 'gook', 'nigger', 'shit'] +# 'hasNoProfanities' validator. All of these should be in lowercase. +PROFANITIES_LIST = ('asshat', 'asshead', 'asshole', 'cunt', 'fuck', 'gook', 'nigger', 'shit') # The group ID that designates which users are banned. # Set to None if you're not using it. diff --git a/django/core/validators.py b/django/core/validators.py index f2f3f44914..af1254c438 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 diff --git a/docs/settings.txt b/docs/settings.txt index 65113b3c30..61355c46ad 100644 --- a/docs/settings.txt +++ b/docs/settings.txt @@ -599,8 +599,11 @@ See also ``APPEND_SLASH``. PROFANITIES_LIST ---------------- -A list of profanities that will trigger a validation error when the -``hasNoProfanities`` validator is called. +A tuple of profanities, as strings, that will trigger a validation error when +the ``hasNoProfanities`` validator is called. + +We don't list the default values here, because that would be profane. To see +the default values, see the file ``django/conf/global_settings.py``. ROOT_URLCONF ------------ |
