Django

Code

Changeset 3784

Show
Ignore:
Timestamp:
09/21/06 21:48:19 (2 years ago)
Author:
mtredinnick
Message:

Fixed #2678 -- Moved the list of profanities for the hasNoProfanities validator
into global_settings. Patch from Matt Croydon.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/conf/global_settings.py

    r3745 r3784  
    273273COMMENTS_ALLOW_PROFANITIES = False 
    274274 
     275# The profanities that will trigger a validation error in the 
     276# 'hasNoProfanities' validator. All of these should be in lower-case. 
     277PROFANITIES_LIST = ['asshat', 'asshead', 'asshole', 'cunt', 'fuck', 'gook', 'nigger', 'shit'] 
     278 
    275279# The group ID that designates which users are banned. 
    276280# Set to None if you're not using it. 
  • django/trunk/django/core/validators.py

    r3634 r3784  
    228228        Watch your mouth! The words "f--k" and "s--t" are not allowed here. 
    229229    """ 
    230     bad_words = ['asshat', 'asshead', 'asshole', 'cunt', 'fuck', 'gook', 'nigger', 'shit'] # all in lower case 
    231230    field_data = field_data.lower() # normalize 
    232     words_seen = [w for w in bad_words if field_data.find(w) > -1] 
     231    words_seen = [w for w in settings.PROFANITIES_LIST if field_data.find(w) > -1] 
    233232    if words_seen: 
    234233        from django.utils.text import get_text_list 
  • django/trunk/docs/settings.txt

    r3706 r3784  
    597597See also ``APPEND_SLASH``. 
    598598 
     599PROFANITIES_LIST 
     600---------------- 
     601 
     602A list of profanities that will trigger a validation error when the 
     603``hasNoProfanities`` validator is called. 
     604 
    599605ROOT_URLCONF 
    600606------------