From 021da38047112ec42cf716ac54d5f61d663b7184 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Thu, 12 Mar 2015 22:44:08 -0400 Subject: [PATCH] Added missing DictionaryDb.is_empty(); fixed moved constfunc reference --- gramps/gen/db/dictionary.py | 9 +++++++++ gramps/webapp/libdjango.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gramps/gen/db/dictionary.py b/gramps/gen/db/dictionary.py index 3fc43795e..8289c6217 100644 --- a/gramps/gen/db/dictionary.py +++ b/gramps/gen/db/dictionary.py @@ -1118,6 +1118,15 @@ class DictionaryDb(DbWriteBase, DbReadBase): self.__do_remove(handle, transaction, self.tag_map, TAG_KEY) + def is_empty(self): + """ + Return true if there are no [primary] records in the database + """ + for table in self._tables: + if len(self._tables[table]["handles_func"]()) > 0: + return False + return True + def __do_remove(self, handle, transaction, data_map, key): if self.readonly or not handle: return diff --git a/gramps/webapp/libdjango.py b/gramps/webapp/libdjango.py index 9d6604b3c..df9407dfc 100644 --- a/gramps/webapp/libdjango.py +++ b/gramps/webapp/libdjango.py @@ -51,7 +51,7 @@ from django.db import transaction import gramps.webapp.grampsdb.models as models from gramps.gen.lib import Name from gramps.gen.utils.id import create_id -from gramps.gen.utils.constfunc import conv_to_unicode +from gramps.gen.constfunc import conv_to_unicode # To get a django person from a django database: # djperson = dji.Person.get(handle='djhgsdh324hjg234hj24')