Skip to content
This repository has been archived by the owner on Jan 8, 2019. It is now read-only.

Commit

Permalink
Copying input's urlresolver thread local per davedash
Browse files Browse the repository at this point in the history
  • Loading branch information
ozten committed May 5, 2011
1 parent 8e7e5d7 commit 832facc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions apps/commons/urlresolvers.py
@@ -1,22 +1,22 @@
from threading import local

from django.conf import settings
from django.core.urlresolvers import reverse as django_reverse
#from django.utils.thread_support import currentThread
from threading import local
from django.utils.translation.trans_real import parse_accept_lang_header


# Thread-local storage for URL prefixes. Access with (get|set)_url_prefix.
_prefixes = local()
_local = local()


def set_url_prefix(prefix):
"""Set the ``prefix`` for the current thread."""
_prefixes.value = prefix
_local.prefix = prefix


def get_url_prefix():
"""Get the prefix for the current thread, or None."""
return _prefixes.value
return getattr(_local, 'prefix', None)


def reverse(viewname, urlconf=None, args=None, kwargs=None, prefix=None):
Expand Down

0 comments on commit 832facc

Please sign in to comment.