DictionaryDB: use backup on load from file, if available

This commit is contained in:
Doug Blank 2016-04-15 09:45:41 -04:00
parent ce33e7509c
commit 684788f2fd

View File

@ -28,6 +28,8 @@ from gramps.gen.db.generic import *
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
import glob
class DictionaryDb(DbGeneric):
"""
Database backend class for dictionary databases
@ -1066,7 +1068,10 @@ class DictionaryDb(DbGeneric):
from gramps.plugins.importer.importxml import importData
from gramps.cli.user import User
if self._directory:
filename = os.path.join(self._directory, "data.gramps")
backups = list(reversed(glob.glob(os.path.join(
self._directory, "backup-*.gramps"))))
if backups:
filename = backups[0]
if os.path.isfile(filename):
importData(self, filename, User())
self.reindex_reference_map(lambda progress: None)