Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support new ming configuration API

  • Loading branch information...
commit 22366babc2346b00d74aa170e9f478677a7b0de3 1 parent 85591fb
Alessandro Molina amol- authored
Showing with 11 additions and 3 deletions.
  1. +11 −3 tg/configuration/app_config.py
14 tg/configuration/app_config.py
View
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.