Add missing 'get_number_of_citations' method (#859)

* Add missing 'get_number_of_citations' method

* update db test for bsddb

* fix trailing whitespace

* typo
This commit is contained in:
romjerome 2019-08-07 20:47:09 +02:00 committed by Paul Culley
parent 9da8f705f6
commit 56afb5bca9
2 changed files with 10 additions and 1 deletions

View File

@ -32,7 +32,7 @@ database to fetch data from). Thus, dbstate.db cannot be left as 'None' because
None has no 'is_open' attribute. Therefore this database class is provided so
that it can be instantiated for dbstate.db.
FIXME: Ideally, only is_open() needs to be implemented here, bacause that is the
FIXME: Ideally, only is_open() needs to be implemented here, because that is the
only method that should really be called, but the Gramps code is not perfect,
and many other methods are called. Calls of other methods could be considered
bugs, so when these are fixed, this class could be reduced.
@ -757,6 +757,14 @@ class DummyDb(M_A_M_B("NewBaseClass", (DbReadBase, Callback, object,), {})):
LOG.warning("database is closed")
return 0
def get_number_of_citations(self):
"""
Return the number of citations currently in the database.
"""
if not self.db_is_open:
LOG.warning("database is closed")
return 0
def get_number_of_tags(self):
"""
Return the number of tags currently in the database.

View File

@ -81,6 +81,7 @@ class DbTest(unittest.TestCase):
"get_number_of_places",
"get_number_of_repositories",
"get_number_of_sources",
"get_number_of_citations",
"get_number_of_tags",
"get_media_from_gramps_id",
"get_media_from_handle",