Added missing DictionaryDb.is_empty(); fixed moved constfunc reference

This commit is contained in:
Doug Blank 2015-03-12 22:44:08 -04:00
parent 102c099f1d
commit 021da38047
2 changed files with 10 additions and 1 deletions

View File

@ -1118,6 +1118,15 @@ class DictionaryDb(DbWriteBase, DbReadBase):
self.__do_remove(handle, transaction, self.tag_map, self.__do_remove(handle, transaction, self.tag_map,
TAG_KEY) 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): def __do_remove(self, handle, transaction, data_map, key):
if self.readonly or not handle: if self.readonly or not handle:
return return

View File

@ -51,7 +51,7 @@ from django.db import transaction
import gramps.webapp.grampsdb.models as models import gramps.webapp.grampsdb.models as models
from gramps.gen.lib import Name from gramps.gen.lib import Name
from gramps.gen.utils.id import create_id 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: # To get a django person from a django database:
# djperson = dji.Person.get(handle='djhgsdh324hjg234hj24') # djperson = dji.Person.get(handle='djhgsdh324hjg234hj24')