Skip to content

Commit

Permalink
Merge pull request #366 from whophil/bugfix/iss-365
Browse files Browse the repository at this point in the history
Fix issue where pymongo Database raises if bool'd
  • Loading branch information
lafrech committed Dec 23, 2021
2 parents 28168d6 + 1b7836d commit 773938e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion umongo/document.py
Expand Up @@ -117,7 +117,7 @@ def collection(cls):
"""
if cls.opts.abstract:
raise NoDBDefinedError('Abstract document has no collection')
if not cls.opts.instance.db:
if cls.opts.instance.db is None:
raise NoDBDefinedError('Instance must be initialized first')
return cls.opts.instance.db[cls.opts.collection_name]

Expand Down
2 changes: 1 addition & 1 deletion umongo/instance.py
Expand Up @@ -133,7 +133,7 @@ def _register_mixin_doc(self, template):

@property
def db(self):
if not self._db:
if self._db is None:
raise NoDBDefinedError('db not set, please call set_db')
return self._db

Expand Down

0 comments on commit 773938e

Please sign in to comment.