Have the application set up instances of the WorkbenchManager.
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 12 Jun 2011 00:47:02 +0000 (19:47 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 12 Jun 2011 00:47:02 +0000 (19:47 -0500)
mediagoblin/app.py
mediagoblin/celery_setup/from_celery.py

index e5949531bebcb7cda73fe9650d2a764169c42a60..da2b7d359f713ae05589d14354f966a50bb949ca 100644 (file)
@@ -25,6 +25,8 @@ from mediagoblin import routing, util, storage, staticdirect
 from mediagoblin.db.open import setup_connection_and_db_from_config
 from mediagoblin.globals import setup_globals
 from mediagoblin.celery_setup import setup_celery_from_config
+from mediagoblin.process_media.workbench import (
+    WorkbenchManager, DEFAULT_WORKBENCH_DIR)
 
 
 class Error(Exception): pass
@@ -39,7 +41,8 @@ class MediaGoblinApp(object):
                  public_store, queue_store,
                  staticdirector,
                  email_sender_address, email_debug_mode,
-                 user_template_path=None):
+                 user_template_path=None,
+                 workbench_path=DEFAULT_WORKBENCH_DIR):
         # Get the template environment
         self.template_loader = util.get_jinja_loader(user_template_path)
         
@@ -66,7 +69,8 @@ class MediaGoblinApp(object):
             db_connection=connection,
             database=self.db,
             public_store=self.public_store,
-            queue_store=self.queue_store)
+            queue_store=self.queue_store,
+            workbench_manager=WorkbenchManager(workbench_path))
 
     def __call__(self, environ, start_response):
         request = Request(environ)
@@ -154,6 +158,7 @@ def paste_app_factory(global_config, **app_config):
         email_sender_address=app_config.get(
             'email_sender_address', 'notice@mediagoblin.example.org'),
         email_debug_mode=asbool(app_config.get('email_debug_mode')),
-        user_template_path=app_config.get('local_templates'))
+        user_template_path=app_config.get('local_templates'),
+        workbench_path=app_config.get('workbench_path', DEFAULT_WORKBENCH_DIR))
 
     return mgoblin_app
index 0669e80c781527fe7bb536bacf6a7212a2f478d4..e1216815b86ccce027b54357d407bdc815f4ea86 100644 (file)
@@ -23,7 +23,8 @@ from mediagoblin import storage
 from mediagoblin.db.open import setup_connection_and_db_from_config
 from mediagoblin.celery_setup import setup_celery_from_config
 from mediagoblin.globals import setup_globals
-from mediagoblin import globals as mgoblin_globals
+from mediagoblin.process_media.workbench import (
+    WorkbenchManager, DEFAULT_WORKBENCH_DIR)
 
 
 OUR_MODULENAME = 'mediagoblin.celery_setup.from_celery'
@@ -76,6 +77,10 @@ def setup_self(setup_globals_func=setup_globals):
     queue_store = storage.storage_system_from_paste_config(
         mgoblin_section, 'queuestore')
 
+    workbench_manager = WorkbenchManager(
+        mgoblin_section.get(
+            'workbench_path', DEFAULT_WORKBENCH_DIR))
+
     setup_globals_func(
         db_connection=connection,
         database=db,
@@ -84,7 +89,8 @@ def setup_self(setup_globals_func=setup_globals):
         email_sender_address=mgoblin_section.get(
             'email_sender_address', 
             'notice@mediagoblin.example.org'),
-        queue_store=queue_store)
+        queue_store=queue_store,
+        workbench_manager=workbench_manager)
 
 
 if os.environ['CELERY_CONFIG_MODULE'] == OUR_MODULENAME: