Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit 321a59a36a545cc90000e1661ba0ed145585eea9 1 parent 61a1a18
Adrian Holovaty authored
4  django/conf/global_settings.py
@@ -274,8 +274,8 @@
274 274
 COMMENTS_ALLOW_PROFANITIES = False
275 275
 
276 276
 # The profanities that will trigger a validation error in the
277  
-# 'hasNoProfanities' validator. All of these should be in lower-case.
278  
-PROFANITIES_LIST = ['asshat', 'asshead', 'asshole', 'cunt', 'fuck', 'gook', 'nigger', 'shit']
  277
+# 'hasNoProfanities' validator. All of these should be in lowercase.
  278
+PROFANITIES_LIST = ('asshat', 'asshead', 'asshole', 'cunt', 'fuck', 'gook', 'nigger', 'shit')
279 279
 
280 280
 # The group ID that designates which users are banned.
281 281
 # Set to None if you're not using it.
2  django/core/validators.py
@@ -249,7 +249,7 @@ def hasNoProfanities(field_data, all_data):
249 249
         Watch your mouth! The words "f--k" and "s--t" are not allowed here.
250 250
     """
251 251
     field_data = field_data.lower() # normalize
252  
-    words_seen = [w for w in settings.PROFANITIES_LIST if field_data.find(w) > -1]
  252
+    words_seen = [w for w in settings.PROFANITIES_LIST if w in field_data]
253 253
     if words_seen:
254 254
         from django.utils.text import get_text_list
255 255
         plural = len(words_seen) > 1
7  docs/settings.txt
@@ -599,8 +599,11 @@ See also ``APPEND_SLASH``.
599 599
 PROFANITIES_LIST
600 600
 ----------------
601 601
 
602  
-A list of profanities that will trigger a validation error when the
603  
-``hasNoProfanities`` validator is called.
  602
+A tuple of profanities, as strings, that will trigger a validation error when
  603
+the ``hasNoProfanities`` validator is called.
  604
+
  605
+We don't list the default values here, because that would be profane. To see
  606
+the default values, see the file ``django/conf/global_settings.py``.
604 607
 
605 608
 ROOT_URLCONF
606 609
 ------------

0 notes on commit 321a59a

Please sign in to comment.
Something went wrong with that request. Please try again.