Ticket #8794: 8794.diff
File 8794.diff, 2.6 KB (added by , 16 years ago) |
---|
-
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://' 330 330 CACHE_MIDDLEWARE_KEY_PREFIX = '' 331 331 CACHE_MIDDLEWARE_SECONDS = 600 332 332 333 ####################334 # COMMENTS #335 ####################336 337 COMMENTS_ALLOW_PROFANITIES = False338 339 # The profanities that will trigger a validation error in the340 # '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 = None346 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 = None350 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 = None354 355 # The system will e-mail MANAGERS the first COMMENTS_FIRST_FEW comments by each356 # user. Set this to 0 if you want to disable it.357 COMMENTS_FIRST_FEW = 0358 359 # A tuple of IP addresses that have been banned from participating in various360 # Django-powered features.361 BANNED_IPS = ()362 363 333 ################## 364 334 # AUTHENTICATION # 365 335 ################## -
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): 112 112 raise forms.ValidationError("Timestamp check failed") 113 113 return ts 114 114 115 def clean_comment(self):116 """117 If COMMENTS_ALLOW_PROFANITIES is False, check that the comment doesn't118 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) > 1125 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 comment130 131 115 def generate_security_data(self): 132 116 """Generate a dict of security data for "initial" data.""" 133 117 timestamp = int(time.time())