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.surname_list = self.get_surname_list()
self.set_save_path(directory) 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 = DbGenericUndo(self, self.undolog)
self.undodb.open() self.undodb.open()

View File

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

View File

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