Factor setup_workbench into init submodule.
authorElrond <elrond+mediagoblin.org@samba-tng.org>
Thu, 7 Jul 2011 20:08:20 +0000 (22:08 +0200)
committerElrond <elrond+mediagoblin.org@samba-tng.org>
Thu, 7 Jul 2011 20:08:20 +0000 (22:08 +0200)
mediagoblin/app.py
mediagoblin/edit/forms.py
mediagoblin/init/__init__.py

index 6d6346d2ffa5d540a8c56b7bfe436d9eaccffafa..c5fcc1ddb4dae2f3e048e88660f7b47e2c397108 100644 (file)
@@ -25,8 +25,7 @@ from mediagoblin.db.open import setup_connection_and_db_from_config
 from mediagoblin.mg_globals import setup_globals
 from mediagoblin.init.celery import setup_celery_from_config
 from mediagoblin.init import get_jinja_loader, get_staticdirector, \
-    setup_global_and_app_config
-from mediagoblin.workbench import WorkbenchManager
+    setup_global_and_app_config, setup_workbench
 
 
 class MediaGoblinApp(object):
@@ -104,8 +103,8 @@ class MediaGoblinApp(object):
             db_connection=self.connection,
             database=self.db,
             public_store=self.public_store,
-            queue_store=self.queue_store,
-            workbench_manager=WorkbenchManager(app_config['workbench_path']))
+            queue_store=self.queue_store)
+        setup_workbench()
 
     def __call__(self, environ, start_response):
         request = Request(environ)
index 2efdb9e4380d29c84c0b90a5d9505bc3be00febb..d5e7f0a99821670799c9445f76d83e3d0ea4ba66 100644 (file)
@@ -31,4 +31,5 @@ class EditProfileForm(wtforms.Form):
         [wtforms.validators.Length(min=0, max=500)])
     url = wtforms.TextField(
         'Website',
-        [wtforms.validators.URL(message='Improperly formed URL')])
+        [wtforms.validators.Optional(),
+         wtforms.validators.URL(message='Improperly formed URL')])
index 1c34c5996b368e7e97ec908e676b8332dddfa18c..6320d21bcacdf675cadbb9da240afdd6b1422a9c 100644 (file)
@@ -18,7 +18,9 @@ import jinja2
 from mediagoblin import staticdirect
 from mediagoblin.init.config import (
     read_mediagoblin_config, generate_validation_report)
+from mediagoblin import mg_globals
 from mediagoblin.mg_globals import setup_globals
+from mediagoblin.workbench import WorkbenchManager
 
 
 class Error(Exception): pass
@@ -70,3 +72,11 @@ def get_staticdirector(app_config):
         raise ImproperlyConfigured(
             "One of direct_remote_path or "
             "direct_remote_paths must be provided")
+
+
+def setup_workbench():
+    app_config = mg_globals.app_config
+
+    workbench_manager = WorkbenchManager(app_config['workbench_path'])
+
+    setup_globals(workbench_manager = workbench_manager)