beware the unicode monster!
This commit is contained in:
Родитель
2454aa7208
Коммит
5cfc8375b2
|
@ -50,6 +50,12 @@ class BlocklistItemTest(BlocklistTest):
|
|||
self.app = BlocklistApp.objects.create(blitem=self.item,
|
||||
guid=amo.FIREFOX.guid)
|
||||
|
||||
def stupid_unicode_test(self):
|
||||
junk = u'\xc2\x80\x15\xc2\x80\xc3'
|
||||
url = reverse('blocklist', args=[3, amo.FIREFOX.guid, junk])
|
||||
# Just make sure it doesn't fail.
|
||||
eq_(self.client.get(url).status_code, 200)
|
||||
|
||||
def test_content_type(self):
|
||||
response = self.client.get(self.fx4_url)
|
||||
eq_(response['Content-Type'], 'text/xml')
|
||||
|
|
|
@ -10,6 +10,7 @@ from django.conf import settings
|
|||
from django.db.models import Q, signals as db_signals
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.cache import patch_cache_control
|
||||
from django.utils.encoding import smart_str
|
||||
|
||||
import jingo
|
||||
import redisutils
|
||||
|
@ -28,7 +29,7 @@ BlItem = collections.namedtuple('BlItem', 'rows os modified block_id')
|
|||
def blocklist(request, apiver, app, appver):
|
||||
key = 'blocklist:%s:%s:%s' % (apiver, app, appver)
|
||||
# Use md5 to make sure the memcached key is clean.
|
||||
key = hashlib.md5(key).hexdigest()
|
||||
key = hashlib.md5(smart_str(key)).hexdigest()
|
||||
response = cache.get(key)
|
||||
if response is None:
|
||||
response = _blocklist(request, apiver, app, appver)
|
||||
|
|
Загрузка…
Ссылка в новой задаче