2013-05-19 09:44:46 +00:00
|
|
|
from threading import local
|
|
|
|
|
|
|
|
|
|
|
|
class TransRealMixin(object):
|
|
|
|
"""This is the only way to reset the translation machinery. Otherwise
|
|
|
|
the test suite occasionally fails because of global state pollution
|
|
|
|
between tests."""
|
|
|
|
def flush_caches(self):
|
|
|
|
from django.utils.translation import trans_real
|
|
|
|
trans_real._translations = {}
|
|
|
|
trans_real._active = local()
|
|
|
|
trans_real._default = None
|
|
|
|
trans_real._accepted = {}
|
2013-05-19 10:43:34 +00:00
|
|
|
trans_real._checked_languages = {}
|
2013-05-19 09:44:46 +00:00
|
|
|
|
|
|
|
def tearDown(self):
|
|
|
|
self.flush_caches()
|
|
|
|
super(TransRealMixin, self).tearDown()
|