summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-05-05 10:19:49 -0500
committerDan McGee <dan@archlinux.org>2012-05-05 10:19:49 -0500
commitd4c7a48623f90cdc508d1824bf47ce3e398dd820 (patch)
treeb1cccb1b2e7cb1e89ec09639d83131694f321d02
parent86f8efaeb1f67138c194d0c373f9d91e2999c5dd (diff)
Fix suggestion caching again for non-ASCII charactersrelease_2012-05-05
This is why you should test this stuff with random input before rolling it out. Whoops. URL that caught this problem: /opensearch/packages/suggest?q=%D7%A0%D7%9F%D7%92%D7%9F aka /opensearch/packages/suggest?q=נןגן Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--packages/views/__init__.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/packages/views/__init__.py b/packages/views/__init__.py
index 559368b9..60c3a46b 100644
--- a/packages/views/__init__.py
+++ b/packages/views/__init__.py
@@ -47,7 +47,8 @@ def opensearch_suggest(request):
if search_term == '':
return HttpResponse('', mimetype='application/x-suggestions+json')
- cache_key = 'opensearch:packages:' + hashlib.md5(search_term).hexdigest()
+ cache_key = 'opensearch:packages:' + \
+ hashlib.md5(search_term.encode('utf-8')).hexdigest()
to_json = cache.get(cache_key, None)
if to_json is None:
names = Package.objects.filter(