6767: WIP, allow opening of database without using filesystem

This commit is contained in:
Doug Blank 2015-08-06 13:22:44 -04:00
parent f4553d967f
commit 8bedb03d1d
3 changed files with 9 additions and 4 deletions

View File

@ -765,7 +765,10 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
self.surname_list = self.get_surname_list()
self.set_save_path(directory)
self.undolog = os.path.join(self._directory, DBUNDOFN)
if self._directory:
self.undolog = os.path.join(self._directory, DBUNDOFN)
else:
self.undolog = None
self.undodb = DbGenericUndo(self, self.undolog)
self.undodb.open()

View File

@ -176,6 +176,7 @@ def import_as_dict(filename, user=None):
if user is None:
user = User()
db = DictionaryDb()
db.load(None)
db.set_feature("skip-import-additions", True)
dbstate = DbState()
climanager = CLIManager(dbstate, setloader=False, user=user)

View File

@ -970,6 +970,7 @@ class DictionaryDb(DbGeneric):
# Dictionary-specific load:
from gramps.plugins.importer.importxml import importData
from gramps.cli.user import User
filename = os.path.join(self._directory, "data.gramps")
if os.path.isfile(filename):
importData(self, filename, User())
if self._directory:
filename = os.path.join(self._directory, "data.gramps")
if os.path.isfile(filename):
importData(self, filename, User())