From 855933ab2abeea28ab9ec717387aee1836994581 Mon Sep 17 00:00:00 2001 From: Robert Kajic Date: Fri, 24 Feb 2012 00:07:57 +0100 Subject: [PATCH] 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. --- mongoengine/connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mongoengine/connection.py b/mongoengine/connection.py index 79c5b5a8..70eac1e7 100644 --- a/mongoengine/connection.py +++ b/mongoengine/connection.py @@ -42,7 +42,7 @@ def register_connection(alias, name, host='localhost', port=27017, # Handle uri style connections if "://" in 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 "\ "database name in string") uri_dict['name'] = uri_dict.get('database')