Added multidb support

No change required to upgrade to multiple databases. Aliases are used
to describe the database and these can be manually registered or fall
through to a default alias using connect.

Made get_connection and get_db first class members of the connection class.
Old style _get_connection and _get_db still supported.

Refs: #84 #87 #93 #215
This commit is contained in:
Ross Lawley
2011-11-18 07:22:37 -08:00
parent 63c5a4dd65
commit e80144e9f2
15 changed files with 180 additions and 103 deletions

View File

@@ -6,7 +6,7 @@ import uuid
from decimal import Decimal
from mongoengine import *
from mongoengine.connection import _get_db
from mongoengine.connection import get_db
from mongoengine.base import _document_registry, NotRegistered
TEST_IMAGE_PATH = os.path.join(os.path.dirname(__file__), 'mongoengine.png')
@@ -16,7 +16,7 @@ class FieldTest(unittest.TestCase):
def setUp(self):
connect(db='mongoenginetest')
self.db = _get_db()
self.db = get_db()
def test_default_values(self):
"""Ensure that default field values are used when creating a document.