Ticket #2678: profanities.patch
File profanities.patch, 1.6 KB (added by , 18 years ago) |
---|
-
django/core/validators.py
226 226 check for whether each profanity exists within the string, so 'fuck' will 227 227 catch 'motherfucker' as well. Raises a ValidationError such as: 228 228 Watch your mouth! The words "f--k" and "s--t" are not allowed here. 229 If ``PROFANITIES_LIST`` is defined in the settings file, that list of will 230 be used, otherwise a default list of profanities will be used. 229 231 """ 230 bad_words = ['asshat', 'asshead', 'asshole', 'cunt', 'fuck', 'gook', 'nigger', 'shit'] # all in lower case 232 if hasattr(settings, "PROFANITIES_LIST"): 233 bad_words = settings.PROFANITIES_LIST 234 else: 235 bad_words = ['asshat', 'asshead', 'asshole', 'cunt', 'fuck', 'gook', 'nigger', 'shit'] # all in lower case 231 236 field_data = field_data.lower() # normalize 232 237 words_seen = [w for w in bad_words if field_data.find(w) > -1] 233 238 if words_seen: -
docs/settings.txt
596 596 only used if ``CommonMiddleware`` is installed (see the `middleware docs`_). 597 597 See also ``APPEND_SLASH``. 598 598 599 PROFANITIES_LIST 600 ---------------- 601 602 Default: ``['asshat', 'asshead', 'asshole', 'cunt', 'fuck', 'gook', 'nigger', 'shit']`` 603 604 A list of profanities that will trigger a validation error when the ``hasNoProfanities`` 605 validator is called. 606 599 607 ROOT_URLCONF 600 608 ------------ 601 609