From 1c05879f62fe95ae6dfb9ed3411fca989a9164a3 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Fri, 15 May 2015 10:48:14 -0400 Subject: [PATCH] Database API: expore name, full_name, and brief_name --- gramps/plugins/database/dictionarydb.py | 9 +++++++++ gramps/plugins/database/djangodb.py | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/gramps/plugins/database/dictionarydb.py b/gramps/plugins/database/dictionarydb.py index 72a383469..ecdf5a112 100644 --- a/gramps/plugins/database/dictionarydb.py +++ b/gramps/plugins/database/dictionarydb.py @@ -404,6 +404,9 @@ class DictionaryDb(DbWriteBase, DbReadBase, UpdateCallback, Callback): self.abort_possible = False self._bm_changes = 0 self._directory = directory + self.full_name = None + self.path = None + self.brief_name = None if directory: self.load(directory) @@ -1671,6 +1674,9 @@ class DictionaryDb(DbWriteBase, DbReadBase, UpdateCallback, Callback): from gramps.plugins.importer.importxml import importData from gramps.cli.user import User self._directory = directory + self.full_name = os.path.abspath(self._directory) + self.path = self.full_name + self.brief_name = os.path.basename(self._directory) filename = os.path.join(directory, "data.gramps") if os.path.isfile(filename): importData(self, filename, User()) @@ -1690,6 +1696,9 @@ class DictionaryDb(DbWriteBase, DbReadBase, UpdateCallback, Callback): def set_save_path(self, directory): self._directory = directory + self.full_name = os.path.abspath(self._directory) + self.path = self.full_name + self.brief_name = os.path.basename(self._directory) def undo(self, update_history=True): pass diff --git a/gramps/plugins/database/djangodb.py b/gramps/plugins/database/djangodb.py index 1c6e3a6a1..182295645 100644 --- a/gramps/plugins/database/djangodb.py +++ b/gramps/plugins/database/djangodb.py @@ -349,6 +349,9 @@ class DbDjango(DbWriteBase, DbReadBase, UpdateCallback, Callback): self.abort_possible = False self._bm_changes = 0 self._directory = directory + self.full_name = None + self.path = None + self.brief_name = None if directory: self.load(directory) @@ -358,6 +361,9 @@ class DbDjango(DbWriteBase, DbReadBase, UpdateCallback, Callback): force_bsddb_downgrade=False, force_python_upgrade=False): self._directory = directory + self.full_name = os.path.abspath(self._directory) + self.path = self.full_name + self.brief_name = os.path.basename(self._directory) from django.conf import settings default_settings = {"__file__": os.path.join(directory, "default_settings.py")} @@ -1836,6 +1842,9 @@ class DbDjango(DbWriteBase, DbReadBase, UpdateCallback, Callback): def set_save_path(self, directory): self._directory = directory + self.full_name = os.path.abspath(self._directory) + self.path = self.full_name + self.brief_name = os.path.basename(self._directory) ## Get types: def get_event_attribute_types(self):