Ticket #8794: 8794.diff

File 8794.diff, 2.6 KB (added by thejaswi_puthraya, 7 years ago)

git-patch of the latest checkout

  • django/conf/global_settings.py

    diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py
    index 9085120..ee5355a 100644
    a b CACHE_BACKEND = 'locmem://' 
    330330CACHE_MIDDLEWARE_KEY_PREFIX = ''
    331331CACHE_MIDDLEWARE_SECONDS = 600
    332332
    333 ####################
    334 # COMMENTS         #
    335 ####################
    336 
    337 COMMENTS_ALLOW_PROFANITIES = False
    338 
    339 # The profanities that will trigger a validation error in the
    340 # 'hasNoProfanities' validator. All of these should be in lowercase.
    341 PROFANITIES_LIST = ('asshat', 'asshead', 'asshole', 'cunt', 'fuck', 'gook', 'nigger', 'shit')
    342 
    343 # The group ID that designates which users are banned.
    344 # Set to None if you're not using it.
    345 COMMENTS_BANNED_USERS_GROUP = None
    346 
    347 # The group ID that designates which users can moderate comments.
    348 # Set to None if you're not using it.
    349 COMMENTS_MODERATORS_GROUP = None
    350 
    351 # The group ID that designates the users whose comments should be e-mailed to MANAGERS.
    352 # Set to None if you're not using it.
    353 COMMENTS_SKETCHY_USERS_GROUP = None
    354 
    355 # The system will e-mail MANAGERS the first COMMENTS_FIRST_FEW comments by each
    356 # user. Set this to 0 if you want to disable it.
    357 COMMENTS_FIRST_FEW = 0
    358 
    359 # A tuple of IP addresses that have been banned from participating in various
    360 # Django-powered features.
    361 BANNED_IPS = ()
    362 
    363333##################
    364334# AUTHENTICATION #
    365335##################
  • django/contrib/comments/forms.py

    diff --git a/django/contrib/comments/forms.py b/django/contrib/comments/forms.py
    index 39016d8..c1e82be 100644
    a b class CommentForm(forms.Form): 
    112112            raise forms.ValidationError("Timestamp check failed")
    113113        return ts
    114114
    115     def clean_comment(self):
    116         """
    117         If COMMENTS_ALLOW_PROFANITIES is False, check that the comment doesn't
    118         contain anything in PROFANITIES_LIST.
    119         """
    120         comment = self.cleaned_data["comment"]
    121         if settings.COMMENTS_ALLOW_PROFANITIES == False:
    122             bad_words = [w for w in settings.PROFANITIES_LIST if w in comment.lower()]
    123             if bad_words:
    124                 plural = len(bad_words) > 1
    125                 raise forms.ValidationError(ngettext(
    126                     "Watch your mouth! The word %s is not allowed here.",
    127                     "Watch your mouth! The words %s are not allowed here.", plural) % \
    128                     get_text_list(['"%s%s%s"' % (i[0], '-'*(len(i)-2), i[-1]) for i in bad_words], 'and'))
    129         return comment
    130 
    131115    def generate_security_data(self):
    132116        """Generate a dict of security data for "initial" data."""
    133117        timestamp = int(time.time())
Back to Top