Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
updating for django 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Balogh committed Mar 2, 2011
1 parent 99724d8 commit 65842c4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
3 changes: 0 additions & 3 deletions apps/amo/tests/test_views.py
Expand Up @@ -168,9 +168,6 @@ def test_get_not_allowed(self):

@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)
Expand Down
8 changes: 4 additions & 4 deletions apps/amo/urlresolvers.py
@@ -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
Expand All @@ -19,17 +19,17 @@


# 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():
Expand Down
2 changes: 1 addition & 1 deletion apps/users/views.py
Expand Up @@ -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 '/'.
Expand Down
4 changes: 2 additions & 2 deletions settings.py
Expand Up @@ -211,12 +211,12 @@
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
Expand Down

0 comments on commit 65842c4

Please sign in to comment.