From e4890a8bff1868e09c217addfba51ac6a4e4218b Mon Sep 17 00:00:00 2001 From: Rocky Duan Date: Thu, 23 Aug 2012 02:52:51 -0700 Subject: [PATCH] fixed pluralize --- lms/djangoapps/django_comment_client/helpers.py | 2 +- lms/djangoapps/django_comment_client/mustache_helpers.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lms/djangoapps/django_comment_client/helpers.py b/lms/djangoapps/django_comment_client/helpers.py index e793be27b5..c35559255d 100644 --- a/lms/djangoapps/django_comment_client/helpers.py +++ b/lms/djangoapps/django_comment_client/helpers.py @@ -12,7 +12,7 @@ import urllib import os def pluralize(singular_term, count): - if int(count) >= 2: + if int(count) >= 2 or int(count) == 0: return singular_term + 's' return singular_term diff --git a/lms/djangoapps/django_comment_client/mustache_helpers.py b/lms/djangoapps/django_comment_client/mustache_helpers.py index 1961bf5c90..6f04ca527c 100644 --- a/lms/djangoapps/django_comment_client/mustache_helpers.py +++ b/lms/djangoapps/django_comment_client/mustache_helpers.py @@ -7,7 +7,8 @@ import inspect def pluralize(content, text): num, word = text.split(' ') - if int(num or '0') >= 2: + num = int(num or '0') + if num >= 2 or num == 0: return word + 's' else: return word