From 8e6a06e0288cd566b4b117a3c698f0e7a0c41b17 Mon Sep 17 00:00:00 2001 From: Jeff Balogh Date: Fri, 25 Mar 2011 11:11:23 -0700 Subject: [PATCH] beware the unicode monster (bug 643079) --- apps/editors/helpers.py | 4 ++-- apps/editors/tests/test_helpers.py | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/apps/editors/helpers.py b/apps/editors/helpers.py index b7f113ddb3..58b14035fe 100644 --- a/apps/editors/helpers.py +++ b/apps/editors/helpers.py @@ -35,8 +35,8 @@ def editor_page_title(context, title=None, addon=None): if addon: title = u'%s :: %s' % (title, addon.name) else: - section = unicode(_('Editor Tools')) - title = '%s :: %s' % (title, section) if title else section + section = _('Editor Tools') + title = u'%s :: %s' % (title, section) if title else section return page_title(context, title) diff --git a/apps/editors/tests/test_helpers.py b/apps/editors/tests/test_helpers.py index 821c05f0eb..57ba13f2b9 100644 --- a/apps/editors/tests/test_helpers.py +++ b/apps/editors/tests/test_helpers.py @@ -13,14 +13,16 @@ from nose.tools import eq_ from pyquery import PyQuery as pq import test_utils -from addons.models import Addon import amo +from addons.models import Addon from amo.urlresolvers import reverse from devhub.models import ActivityLog from editors.helpers import (ViewPendingQueueTable, ReviewHelper, ReviewFiles, ReviewAddon, NOMINATED_STATUSES, - PRELIMINARY_STATUSES, PENDING_STATUSES) + PRELIMINARY_STATUSES, PENDING_STATUSES, + editor_page_title) from files.models import File +from translations.models import Translation from users.models import UserProfile @@ -552,3 +554,10 @@ class TestReviewHelper(test_utils.TestCase): getattr(self.helper.handler, process)() assert File.objects.get(pk=self.file.pk).reviewed, ( 'Reviewed for status %r, %s()' % (status, process)) + + +def test_page_title_unicode(): + t = Translation(localized_string=u'\u30de\u30eb\u30c1\u30d712\u30eb') + request = Mock() + request.APP = amo.FIREFOX + editor_page_title({'request': request}, title=t)