Permalink
Browse files

urljoin behavior on schemas seems to change depending on python version

  • Loading branch information...
amol- committed Jan 10, 2013
1 parent 26c777a commit 586dbcb64b8ce5ade620efb6d9e6cfe77586959d
Showing with 5 additions and 3 deletions.
  1. +5 −3 tg/configuration/app_config.py
@@ -551,9 +551,11 @@ def setup_ming(self):
"""Setup MongoDB database engine using Ming"""
try:
from ming import create_datastore
- from urlparse import urljoin
def create_ming_datastore(url, database, **kw):
- return create_datastore(urljoin(url, database), **kw)
+ if database and url[-1] != '/':
+ url += '/'
+ ming_url = url + database
+ return create_datastore(ming_url, **kw)
except ImportError:
from ming.datastore import DataStore
def create_ming_datastore(url, database, **kw):
@@ -575,7 +577,7 @@ def mongo_read_pref(value):
datastore_options.pop('host', None)
datastore_options.pop('port', None)
- datastore = create_ming_datastore(config['ming.url'], config['ming.db'])
+ datastore = create_ming_datastore(config['ming.url'], config.get('ming.db', ''))
config['pylons.app_globals'].ming_datastore = datastore
self.package.model.init_model(datastore)

0 comments on commit 586dbcb

Please sign in to comment.