mirror of https://github.com/django/django.git
Fixed #16403 -- Correctly use ungettext in comments form. Thanks, poirier.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16505 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
7db68a888b
commit
c6ae0fa549
|
@ -173,11 +173,10 @@ class CommentDetailsForm(CommentSecurityForm):
|
||||||
if settings.COMMENTS_ALLOW_PROFANITIES == False:
|
if settings.COMMENTS_ALLOW_PROFANITIES == False:
|
||||||
bad_words = [w for w in settings.PROFANITIES_LIST if w in comment.lower()]
|
bad_words = [w for w in settings.PROFANITIES_LIST if w in comment.lower()]
|
||||||
if bad_words:
|
if bad_words:
|
||||||
plural = len(bad_words) > 1
|
|
||||||
raise forms.ValidationError(ungettext(
|
raise forms.ValidationError(ungettext(
|
||||||
"Watch your mouth! The word %s is not allowed here.",
|
"Watch your mouth! The word %s is not allowed here.",
|
||||||
"Watch your mouth! The words %s are not allowed here.", plural) % \
|
"Watch your mouth! The words %s are not allowed here.", len(bad_words))
|
||||||
get_text_list(['"%s%s%s"' % (i[0], '-'*(len(i)-2), i[-1]) for i in bad_words], 'and'))
|
% get_text_list(['"%s%s%s"' % (i[0], '-'*(len(i)-2), i[-1]) for i in bad_words], 'and'))
|
||||||
return comment
|
return comment
|
||||||
|
|
||||||
class CommentForm(CommentDetailsForm):
|
class CommentForm(CommentDetailsForm):
|
||||||
|
|
Loading…
Reference in New Issue