diff options
author | Jakob Kramer <jakob.kramer@gmx.de> | 2012-07-18 19:25:53 +0200 |
---|---|---|
committer | Jakob Kramer <jakob.kramer@gmx.de> | 2012-07-18 19:25:53 +0200 |
commit | c80982c7a0d64f01cb4dd44bfde334782f2a72c0 (patch) | |
tree | 6804c8d00d90622d1b48be1a4a2c423cd066b01b /mediagoblin/mg_globals.py | |
parent | 8464bcc3e86e223db0739101c0b5d914eea225af (diff) | |
download | mediagoblin-c80982c7a0d64f01cb4dd44bfde334782f2a72c0.tar.lz mediagoblin-c80982c7a0d64f01cb4dd44bfde334782f2a72c0.tar.xz mediagoblin-c80982c7a0d64f01cb4dd44bfde334782f2a72c0.zip |
make mg_globals.translations thread-safe
I added mg_globals.thread_scope (an instance of threading.local)
and made `translations' an attribute of it.
Diffstat (limited to 'mediagoblin/mg_globals.py')
-rw-r--r-- | mediagoblin/mg_globals.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mediagoblin/mg_globals.py b/mediagoblin/mg_globals.py index 3bd2070d..fffa1dda 100644 --- a/mediagoblin/mg_globals.py +++ b/mediagoblin/mg_globals.py @@ -19,6 +19,7 @@ In some places, we need to access the database, public_store, queue_store import gettext import pkg_resources +import threading ############################# @@ -41,8 +42,11 @@ queue_store = None # A WorkBenchManager workbench_manager = None +# A thread-local scope +thread_scope = threading.local() + # gettext -translations = gettext.find( +thread_scope.translations = gettext.find( 'mediagoblin', pkg_resources.resource_filename( 'mediagoblin', 'translations'), ['en']) |