From 2c03c63990284268cd530505e0c9d1339ec8b3d0 Mon Sep 17 00:00:00 2001 From: Carson Gee Date: Wed, 26 Mar 2014 21:36:32 -0400 Subject: [PATCH] Properly get lazily translated exception message --- cms/djangoapps/contentstore/tests/test_export_git.py | 10 ++++++++++ cms/djangoapps/contentstore/views/export_git.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/tests/test_export_git.py b/cms/djangoapps/contentstore/tests/test_export_git.py index 3d6fef7239..9a29ae6058 100644 --- a/cms/djangoapps/contentstore/tests/test_export_git.py +++ b/cms/djangoapps/contentstore/tests/test_export_git.py @@ -76,6 +76,16 @@ class TestExportGit(CourseTestCase): response = self.client.get('{}?action=push'.format(self.test_url)) self.assertIn('Export Failed:', response.content) + def test_exception_translation(self): + """ + Regression test for making sure errors are properly stringified + """ + self.course_module.giturl = 'foobar' + get_modulestore(self.course_module.location).update_item(self.course_module) + + response = self.client.get('{}?action=push'.format(self.test_url)) + self.assertNotIn('django.utils.functional.__proxy__', response.content) + def test_course_export_success(self): """ Test successful course export response. diff --git a/cms/djangoapps/contentstore/views/export_git.py b/cms/djangoapps/contentstore/views/export_git.py index e3ec9f4f60..d02ff1aeb3 100644 --- a/cms/djangoapps/contentstore/views/export_git.py +++ b/cms/djangoapps/contentstore/views/export_git.py @@ -45,7 +45,7 @@ def export_git(request, org, course, name): msg = _('Course successfully exported to git repository') except git_export_utils.GitExportError as ex: failed = True - msg = str(ex) + msg = unicode(ex) return render_to_response('export_git.html', { 'context_course': course_module,