Merge branch 'master' into f411_new_migrations
authorChristopher Allan Webber <cwebber@dustycloud.org>
Thu, 14 Jul 2011 04:14:42 +0000 (23:14 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Thu, 14 Jul 2011 04:14:42 +0000 (23:14 -0500)
Conflicts:
mediagoblin/db/open.py

1  2 
mediagoblin/app.py
mediagoblin/db/open.py
mediagoblin/db/util.py

index 523b930289b77d9de2cb648fad998d6829244f3f,147db09c42c4b7f4e6da511cace6a974121cdb02..7a6a1f33c7c4610a7dcf32dc98d048a35d97d4fa
@@@ -20,19 -20,12 +20,13 @@@ import urlli
  import routes
  from webob import Request, exc
  
- from mediagoblin import routing, util, storage, staticdirect
- from mediagoblin.init.config import (
-     read_mediagoblin_config, generate_validation_report)
+ from mediagoblin import routing, util, storage
  from mediagoblin.db.open import setup_connection_and_db_from_config
 +from mediagoblin.db.util import MigrationManager
  from mediagoblin.mg_globals import setup_globals
  from mediagoblin.init.celery import setup_celery_from_config
- from mediagoblin.init import get_jinja_loader
- from mediagoblin.workbench import WorkbenchManager
- class Error(Exception): pass
- class ImproperlyConfigured(Error): pass
+ from mediagoblin.init import get_jinja_loader, get_staticdirector, \
+     setup_global_and_app_config, setup_workbench
  
  
  class MediaGoblinApp(object):
index cb040c296bec4f0b5b0e08287982b286d8d169ac,b69876773a2c56b89b856505cd9316e2473970f4..e5fde6f970e5d3abcc121431ef370ce35c1670ab
@@@ -29,26 -24,14 +29,27 @@@ def connect_database_from_config(app_co
      port = app_config.get('db_port')
      if port:
          port = asint(port)
 -    connection = mongokit.Connection(
 -        app_config.get('db_host'), port)
 +    
 +    if use_pymongo:
 +        connection = pymongo.Connection(
 +            app_config.get('db_host'), port)
 +    else:
 +        connection = mongokit.Connection(
 +            app_config.get('db_host'), port)
      return connection
  
 -def setup_connection_and_db_from_config(app_config):
 -    connection = connect_database_from_config(app_config)
++
 +def setup_connection_and_db_from_config(app_config, use_pymongo=False):
 +    """
 +    Setup connection and database from config.
 +
 +    Optionally use pymongo instead of mongokit.
 +    """
 +    connection = connect_database_from_config(app_config, use_pymongo)
-     database_path = app_config.get('db_name', 'mediagoblin')
+     database_path = app_config['db_name']
      db = connection[database_path]
 -    models.register_models(connection)
 -    # Could configure indexes here on db
 +
 +    if not use_pymongo:
 +        models.register_models(connection)
 +
      return (connection, db)
Simple merge