From 971713d0c21782fdf2da780cda36cd17e5353af2 Mon Sep 17 00:00:00 2001 From: stv Date: Mon, 16 Feb 2015 04:34:55 -0800 Subject: [PATCH] Remove unreferenced mustache_helpers code I can't seem to find any references to this code outside of the library and the tests themselves. --- .../django_comment_client/mustache_helpers.py | 32 ------------------- .../tests/test_mustache_helpers.py | 27 ---------------- 2 files changed, 59 deletions(-) delete mode 100644 lms/djangoapps/django_comment_client/mustache_helpers.py delete mode 100644 lms/djangoapps/django_comment_client/tests/test_mustache_helpers.py diff --git a/lms/djangoapps/django_comment_client/mustache_helpers.py b/lms/djangoapps/django_comment_client/mustache_helpers.py deleted file mode 100644 index cfda1c7a1d..0000000000 --- a/lms/djangoapps/django_comment_client/mustache_helpers.py +++ /dev/null @@ -1,32 +0,0 @@ -from django.utils.translation import ugettext as _ -import django.core.urlresolvers as urlresolvers -import sys -import inspect - -# This method is used to pluralize the words "discussion" and "comment" -# which is why you need to tack on an "s" for the case of 0 or two or more. - - -def pluralize(content, text): - num, word = text.split(' ') - num = int(num or '0') - if num >= 2 or num == 0: - return word + 's' - else: - return word - - -def url_for_user(content, user_id): - return urlresolvers.reverse('django_comment_client.forum.views.user_profile', args=[content['course_id'], user_id]) - - -def close_thread_text(content): - if content.get('closed'): - return _('Re-open thread') - else: - return _('Close thread') - -current_module = sys.modules[__name__] -all_functions = inspect.getmembers(current_module, inspect.isfunction) - -mustache_helpers = {k: v for k, v in all_functions if not k.startswith('_')} diff --git a/lms/djangoapps/django_comment_client/tests/test_mustache_helpers.py b/lms/djangoapps/django_comment_client/tests/test_mustache_helpers.py deleted file mode 100644 index 67ca9697e4..0000000000 --- a/lms/djangoapps/django_comment_client/tests/test_mustache_helpers.py +++ /dev/null @@ -1,27 +0,0 @@ -from django.test import TestCase -import django_comment_client.mustache_helpers as mustache_helpers - - -class PluralizeTest(TestCase): - def setUp(self): - super(PluralizeTest, self).setUp() - self.text1 = '0 goat' - self.text2 = '1 goat' - self.text3 = '7 goat' - self.content = 'unused argument' - - def test_pluralize(self): - self.assertEqual(mustache_helpers.pluralize(self.content, self.text1), 'goats') - self.assertEqual(mustache_helpers.pluralize(self.content, self.text2), 'goat') - self.assertEqual(mustache_helpers.pluralize(self.content, self.text3), 'goats') - - -class CloseThreadTextTest(TestCase): - def setUp(self): - super(CloseThreadTextTest, self).setUp() - self.contentClosed = {'closed': True} - self.contentOpen = {'closed': False} - - def test_close_thread_text(self): - self.assertEqual(mustache_helpers.close_thread_text(self.contentClosed), 'Re-open thread') - self.assertEqual(mustache_helpers.close_thread_text(self.contentOpen), 'Close thread')