Fix the ._get_db() attribute after a Document.switch_db()

Without this patch, I've got:

```
myobj._get_db()

<bound method TopLevelDocumentMetaclass._get_db of <class 'oneflow.core.models.nonrel.Article'>>

```

I need to `myobj._get_db()()` to get the database.

I felt this like a bug.

regards,
This commit is contained in:
Olivier Cortès 2013-08-12 19:12:53 +02:00
parent 5bcc454678
commit f30208f345

View File

@ -400,7 +400,7 @@ class Document(BaseDocument):
"""
with switch_db(self.__class__, db_alias) as cls:
collection = cls._get_collection()
db = cls._get_db
db = cls._get_db()
self._get_collection = lambda: collection
self._get_db = lambda: db
self._collection = collection