This commit is contained in:
Jeff Balogh 2011-02-28 20:55:21 -08:00
Родитель 65de239dd1
Коммит 106d55f276
4 изменённых файлов: 7 добавлений и 10 удалений

Просмотреть файл

@ -168,9 +168,6 @@ class TestPaypal(test_utils.TestCase):
@patch('amo.views.urllib2.urlopen')
def test_mysterious_contribution(self, urlopen):
scheme, servers, _ = parse_backend_uri(settings.CACHE_BACKEND)
if 'dummy' in scheme:
raise SkipTest()
urlopen.return_value = self.urlopener('VERIFIED')
key = "%s%s:%s" % (settings.CACHE_PREFIX, 'contrib', self.item)

Просмотреть файл

@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
import hashlib
import urllib
from threading import local
from urlparse import urlparse, urlsplit, urlunsplit
from django.conf import settings
from django.core import urlresolvers
from django.utils import encoding
from django.utils.thread_support import currentThread
from django.utils.translation.trans_real import parse_accept_lang_header
import jinja2
@ -19,17 +19,17 @@ django_reverse = urlresolvers.reverse
# Thread-local storage for URL prefixes. Access with {get,set}_url_prefix.
_prefixes = {}
_local = local()
def set_url_prefix(prefix):
"""Set ``prefix`` for the current thread."""
_prefixes[currentThread()] = prefix
_local.prefix = prefix
def get_url_prefix():
"""Get the prefix for the current thread, or None."""
return _prefixes.get(currentThread())
return getattr(_local, 'prefix', None)
def clean_url_prefixes():

Просмотреть файл

@ -208,7 +208,7 @@ def _clean_next_url(request):
# We want to not redirect outside of AMO via login/logout.
if url and '://' in url:
url = None
url = '/'
# TODO(davedash): This is a remora-ism, let's remove this after remora and
# since all zamboni 'to' parameters will begin with '/'.

Просмотреть файл

@ -211,12 +211,12 @@ TEMPLATE_DIRS = (
def JINJA_CONFIG():
import jinja2
from django.conf import settings
from caching.base import cache
from django.core.cache import cache
config = {'extensions': ['tower.template.i18n', 'amo.ext.cache',
'jinja2.ext.do',
'jinja2.ext.with_', 'jinja2.ext.loopcontrols'],
'finalize': lambda x: x if x is not None else ''}
if 'memcached' in cache.scheme and not settings.DEBUG:
if not settings.DEBUG:
# We're passing the _cache object directly to jinja because
# Django can't store binary directly; it enforces unicode on it.
# Details: http://jinja.pocoo.org/2/documentation/api#bytecode-cache