Added missing bookmark count methods to djangodb and dictionarydb

This commit is contained in:
Doug Blank 2015-05-14 23:15:30 -04:00
parent 11ac0f1551
commit 5171b3748d
2 changed files with 27 additions and 0 deletions

View File

@ -393,6 +393,7 @@ class DictionaryDb(DbWriteBase, DbReadBase, UpdateCallback, Callback):
self.transaction = None
self.undodb = DbUndo(self)
self.abort_possible = False
self._bm_changes = 0
self._directory = directory
if directory:
self.load(directory)
@ -1689,3 +1690,15 @@ class DictionaryDb(DbWriteBase, DbReadBase, UpdateCallback, Callback):
with open(versionpath, "w") as version_file:
version_file.write("dictionarydb")
def report_bm_change(self):
"""
Add 1 to the number of bookmark changes during this session.
"""
self._bm_changes += 1
def db_has_bm_changes(self):
"""
Return whethere there were bookmark changes during the session.
"""
return self._bm_changes > 0

View File

@ -338,6 +338,7 @@ class DbDjango(DbWriteBase, DbReadBase, UpdateCallback, Callback):
self.use_db_cache = True
self.undodb = DbUndo(self)
self.abort_possible = False
self._bm_changes = 0
self._directory = directory
if directory:
self.load(directory)
@ -2088,3 +2089,16 @@ class DbDjango(DbWriteBase, DbReadBase, UpdateCallback, Callback):
for filename in os.listdir(defaults):
fullpath = os.path.abspath(os.path.join(defaults, filename))
shutil.copy2(fullpath, directory)
def report_bm_change(self):
"""
Add 1 to the number of bookmark changes during this session.
"""
self._bm_changes += 1
def db_has_bm_changes(self):
"""
Return whethere there were bookmark changes during the session.
"""
return self._bm_changes > 0