Revert "Revert "Import messages in blog views""
[mediagoblin.git] / mediagoblin / mg_globals.py
index fffa1ddae9f083e0aa49fc126607728e5dff6245..7da316804ea2de42ace6b5479221ce8967b2e874 100644 (file)
@@ -21,20 +21,15 @@ import gettext
 import pkg_resources
 import threading
 
+import six
 
 #############################
 # General mediagoblin globals
 #############################
 
-# mongokit.Connection
-db_connection = None
-
-# mongokit.Connection
+# SQL database engine
 database = None
 
-# beaker's cache manager
-cache = None
-
 # should be the same as the 
 public_store = None
 queue_store = None
@@ -45,11 +40,13 @@ workbench_manager = None
 # A thread-local scope
 thread_scope = threading.local()
 
-# gettext
-thread_scope.translations = gettext.find(
+# gettext (this needs to default to English so it doesn't break
+#   in case we're running a script without the app like
+#   ./bin/gmg theme assetlink)
+thread_scope.translations = gettext.translation(
     'mediagoblin',
     pkg_resources.resource_filename(
-    'mediagoblin', 'translations'), ['en'])
+        'mediagoblin', 'i18n'), ['en'], fallback=True)
 
 # app and global config objects
 app_config = None
@@ -68,7 +65,7 @@ def setup_globals(**kwargs):
     """
     from mediagoblin import mg_globals
 
-    for key, value in kwargs.iteritems():
+    for key, value in six.iteritems(kwargs):
         if not hasattr(mg_globals, key):
             raise AssertionError("Global %s not known" % key)
         setattr(mg_globals, key, value)