Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Do not crash if a search feed is requested with unicode characters in…
Browse files Browse the repository at this point in the history
… the query. Bug 606001.
  • Loading branch information
Fred Wenzel committed Oct 26, 2010
1 parent 8818b36 commit 0f7d10c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions apps/search/tests.py
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import os
import shutil
import time
Expand Down Expand Up @@ -161,6 +162,14 @@ def test_title(self):
doc = pq(r.content.replace('xmlns', 'xmlnamespace'))
eq_(doc('title').text(), "Firefox Input: 'lol'")

def test_unicode_title(self):
"""Unicode in search queries must not fail. Bug 606001."""
r = self.client.get(reverse('search.feed'),
{'product': 'firefox', 'q': u'é'})
doc = pq(r.content.replace('xmlns', 'xmlnamespace'))
eq_(doc('title').text(), u"Firefox Input: 'é'")


def test_query(self):
r = self.client.get(reverse('search.feed'),
dict(product='firefox',
Expand Down
2 changes: 1 addition & 1 deletion apps/search/views.py
Expand Up @@ -60,7 +60,7 @@ def title(self, obj):
query = request.GET.get('q')

# L10n: This is the title to the Search ATOM feed.
return (_("Firefox Input: '{query}'").format(query=query) if query else
return (_(u"Firefox Input: '{query}'").format(query=query) if query else
_('Firefox Input'))

def items(self, obj):
Expand Down

0 comments on commit 0f7d10c

Please sign in to comment.