uri_dict will have the 'database' key even if the database wasn't present in the uri. We must check it's value as well.

This commit is contained in:
Robert Kajic 2012-02-24 00:07:57 +01:00
parent ece8d25187
commit 855933ab2a

View File

@ -42,7 +42,7 @@ def register_connection(alias, name, host='localhost', port=27017,
# Handle uri style connections # Handle uri style connections
if "://" in host: if "://" in host:
uri_dict = uri_parser.parse_uri(host) uri_dict = uri_parser.parse_uri(host)
if 'database' not in uri_dict: if uri_dict.get('database') is None:
raise ConnectionError("If using URI style connection include "\ raise ConnectionError("If using URI style connection include "\
"database name in string") "database name in string")
uri_dict['name'] = uri_dict.get('database') uri_dict['name'] = uri_dict.get('database')