Permalink
Browse files

Support new ming configuration API

  • Loading branch information...
1 parent 85591fb commit 22366babc2346b00d74aa170e9f478677a7b0de3 @amol- amol- committed Oct 21, 2012
Showing with 11 additions and 3 deletions.
  1. +11 −3 tg/configuration/app_config.py
@@ -549,9 +549,17 @@ def setup_persistence(self):
def setup_ming(self):
"""Setup MongoDB database engine using Ming"""
- from ming.datastore import DataStore
-
- datastore = DataStore(config['ming.url'], database=config['ming.db'])
+ try:
+ from ming import create_datastore
+ from urlparse import urljoin
+ def create_ming_datastore(url, database):
+ return create_datastore(urljoin(url, database))
+ except ImportError:
+ from ming.datastore import DataStore
+ def create_ming_datastore(url, database):
+ return DataStore(url, database=database)
+
+ datastore = create_ming_datastore(config['ming.url'], config['ming.db'])
config['pylons.app_globals'].ming_datastore = datastore
self.package.model.init_model(datastore)

0 comments on commit 22366ba

Please sign in to comment.