3465: Create a new hierarchy of base classes for gramps cor databases (read, write) and add methods
svn: r13894
This commit is contained in:
parent
0f20544be3
commit
ab3dfe1415
@ -22,7 +22,7 @@
|
||||
Provide the database state class
|
||||
"""
|
||||
|
||||
from gen.db import GrampsDbRead
|
||||
from gen.db import DbBsddbRead
|
||||
from gen.utils import Callback
|
||||
import config
|
||||
|
||||
@ -32,18 +32,18 @@ class DbState(Callback):
|
||||
"""
|
||||
|
||||
__signals__ = {
|
||||
'database-changed' : (GrampsDbRead, ),
|
||||
'database-changed' : (DbBsddbRead, ),
|
||||
'active-changed' : (str, ),
|
||||
'no-database' : None,
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
"""
|
||||
Initalize the state with an empty (and useless) GrampsDbRead. This is
|
||||
Initalize the state with an empty (and useless) DbBsddbRead. This is
|
||||
just a place holder until a real DB is assigned.
|
||||
"""
|
||||
Callback.__init__(self)
|
||||
self.db = GrampsDbRead()
|
||||
self.db = DbBsddbRead()
|
||||
self.open = False
|
||||
self.active = None
|
||||
self.sighndl = None
|
||||
@ -115,7 +115,7 @@ class DbState(Callback):
|
||||
Closes the database without a new database
|
||||
"""
|
||||
self.db.close()
|
||||
self.db = GrampsDbRead()
|
||||
self.db = DbBsddbRead()
|
||||
self.db.db_is_open = False
|
||||
self.active = None
|
||||
self.open = False
|
||||
|
@ -443,7 +443,7 @@ def run_report(db, name, **options_str_dict):
|
||||
"""
|
||||
Given a database, run a given report.
|
||||
|
||||
db is a GrampsDb database
|
||||
db is a Db database
|
||||
|
||||
name is the name of a report
|
||||
|
||||
|
@ -93,7 +93,7 @@ def write_endnotes(bibliography, database, doc, printnotes=False):
|
||||
@param bibliography: The bibliography that contains the citations.
|
||||
@type bibliography: L{Bibliography}
|
||||
@param database: The database that the sources come from.
|
||||
@type database: GrampsDbBase
|
||||
@type database: DbBase
|
||||
@param doc: The document to write the endnotes into.
|
||||
@type doc: L{docgen.TextDoc}
|
||||
@param printnotes: Indicate if the notes attached to a source must be
|
||||
|
@ -114,7 +114,7 @@ class SimpleAccess(object):
|
||||
Initialize the SimpleAccess object with the database that will be used.
|
||||
|
||||
@param dbase: GRAMPS database object
|
||||
@type dbase: GrampsDbBase
|
||||
@type dbase: DbBase
|
||||
"""
|
||||
self.dbase = dbase
|
||||
|
||||
|
@ -344,7 +344,7 @@ class ArgHandler(object):
|
||||
else:
|
||||
self.imp_db_path = Utils.get_empty_tempdir("import_dbdir")
|
||||
|
||||
newdb = gen.db.GrampsDBDir()
|
||||
newdb = gen.db.DbBsddb()
|
||||
newdb.write_version(self.imp_db_path)
|
||||
|
||||
try:
|
||||
|
@ -50,7 +50,7 @@ import config
|
||||
import const
|
||||
import Errors
|
||||
import DbState
|
||||
from gen.db import GrampsDBDir
|
||||
from gen.db import DbBsddb
|
||||
import gen.db.exceptions
|
||||
from gen.plug import BasePluginManager
|
||||
from Utils import get_researcher
|
||||
@ -137,7 +137,7 @@ class CLIDbLoader(object):
|
||||
else:
|
||||
mode = 'w'
|
||||
|
||||
dbclass = GrampsDBDir
|
||||
dbclass = DbBsddb
|
||||
|
||||
self.dbstate.change_database(dbclass())
|
||||
self.dbstate.db.disable_signals()
|
||||
@ -147,10 +147,10 @@ class CLIDbLoader(object):
|
||||
try:
|
||||
self.dbstate.db.load(filename, self._pulse_progress, mode)
|
||||
self.dbstate.db.set_save_path(filename)
|
||||
except gen.db.exceptions.GrampsDbUpgradeRequiredError, msg:
|
||||
except gen.db.exceptions.DbUpgradeRequiredError, msg:
|
||||
self.dbstate.no_database()
|
||||
self._errordialog( _("Cannot open database"), str(msg))
|
||||
except gen.db.exceptions.GrampsDbVersionError, msg:
|
||||
except gen.db.exceptions.DbVersionError, msg:
|
||||
self.dbstate.no_database()
|
||||
self._errordialog( _("Cannot open database"), str(msg))
|
||||
except OSError, msg:
|
||||
|
@ -58,7 +58,7 @@ import cPickle as pickle
|
||||
# Gramps libs
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gen.db.exceptions import GrampsDbException
|
||||
from gen.db.exceptions import DbException
|
||||
from gen.db.write import FAMILY_TBL, PLACES_TBL, SOURCES_TBL, MEDIA_TBL, \
|
||||
EVENTS_TBL, PERSON_TBL, REPO_TBL, NOTE_TBL, META
|
||||
|
||||
@ -79,19 +79,19 @@ def backup(database):
|
||||
purpose of this function is to catch any exceptions that occur.
|
||||
|
||||
@param database: database instance to backup
|
||||
@type database: GrampsDbDir
|
||||
@type database: DbDir
|
||||
"""
|
||||
try:
|
||||
__do_export(database)
|
||||
except (OSError, IOError), msg:
|
||||
raise GrampsDbException(str(msg))
|
||||
raise DbException(str(msg))
|
||||
|
||||
def __mk_backup_name(database, base):
|
||||
"""
|
||||
Return the backup name of the database table
|
||||
|
||||
@param database: database instance
|
||||
@type database: GrampsDbDir
|
||||
@type database: DbDir
|
||||
@param base: base name of the table
|
||||
@type base: str
|
||||
"""
|
||||
@ -102,7 +102,7 @@ def __mk_tmp_name(database, base):
|
||||
Return the temporary backup name of the database table
|
||||
|
||||
@param database: database instance
|
||||
@type database: GrampsDbDir
|
||||
@type database: DbDir
|
||||
@param base: base name of the table
|
||||
@type base: str
|
||||
"""
|
||||
@ -114,7 +114,7 @@ def __do_export(database):
|
||||
a file.
|
||||
|
||||
@param database: database instance to backup
|
||||
@type database: GrampsDbDir
|
||||
@type database: DbDir
|
||||
"""
|
||||
try:
|
||||
for (base, tbl) in __build_tbl_map(database):
|
||||
@ -147,12 +147,12 @@ def restore(database):
|
||||
purpose of this function is to catch any exceptions that occur.
|
||||
|
||||
@param database: database instance to restore
|
||||
@type database: GrampsDbDir
|
||||
@type database: DbDir
|
||||
"""
|
||||
try:
|
||||
__do_restore(database)
|
||||
except (OSError, IOError), msg:
|
||||
raise GrampsDbException(str(msg))
|
||||
raise DbException(str(msg))
|
||||
|
||||
def __do_restore(database):
|
||||
"""
|
||||
@ -160,7 +160,7 @@ def __do_restore(database):
|
||||
to the appropriate database file.
|
||||
|
||||
@param database: database instance to backup
|
||||
@type database: GrampsDbDir
|
||||
@type database: DbDir
|
||||
"""
|
||||
for (base, tbl) in __build_tbl_map(database):
|
||||
backup_name = __mk_backup_name(database, base)
|
||||
@ -174,7 +174,7 @@ def __load_tbl_txn(database, backup_table, tbl):
|
||||
Return the temporary backup name of the database table
|
||||
|
||||
@param database: database instance
|
||||
@type database: GrampsDbDir
|
||||
@type database: DbDir
|
||||
@param backup_table: file containing the backup data
|
||||
@type backup_table: file
|
||||
@param tbl: Berkeley db database table
|
||||
@ -194,7 +194,7 @@ def __build_tbl_map(database):
|
||||
Builds a table map of names to database tables.
|
||||
|
||||
@param database: database instance to backup
|
||||
@type database: GrampsDbDir
|
||||
@type database: DbDir
|
||||
"""
|
||||
return [
|
||||
( PERSON_TBL, database.person_map.db),
|
||||
|
2885
src/gen/db/base.py
2885
src/gen/db/base.py
File diff suppressed because it is too large
Load Diff
@ -59,7 +59,7 @@ DBEXT = ".db" # File extension to be used for database files
|
||||
DBUNDOFN = "undo.db" # File name of 'undo' database
|
||||
DBLOCKFN = "lock" # File name of lock file
|
||||
DBRECOVFN = "need_recover" # File name of recovery file
|
||||
DBLOGNAME = ".GrampsDb" # Name of logger
|
||||
DBLOGNAME = ".Db" # Name of logger
|
||||
DBMODE_R = "r" # Read-only access
|
||||
DBMODE_W = "w" # Full Reaw/Write access
|
||||
DBPAGE = 16384 # Size of the pages used to hold items in the database
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
# $Id:exceptions.py 9912 2008-01-22 09:17:46Z acraphae $
|
||||
|
||||
"""Exceptions generated by the GrampsDb package."""
|
||||
"""Exceptions generated by the Db package."""
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -30,7 +30,7 @@
|
||||
from gettext import gettext as _
|
||||
|
||||
|
||||
class GrampsDbException(Exception):
|
||||
class DbException(Exception):
|
||||
|
||||
def __init__(self, value):
|
||||
Exception.__init__(self)
|
||||
@ -39,7 +39,7 @@ class GrampsDbException(Exception):
|
||||
def __str__(self):
|
||||
return self.value
|
||||
|
||||
class GrampsDbWriteFailure(Exception):
|
||||
class DbWriteFailure(Exception):
|
||||
"""
|
||||
Error used to indicate that a write to a database has failed.
|
||||
"""
|
||||
@ -54,7 +54,7 @@ class GrampsDbWriteFailure(Exception):
|
||||
def messages(self):
|
||||
return self.value, self.value2
|
||||
|
||||
class GrampsDbVersionError(Exception):
|
||||
class DbVersionError(Exception):
|
||||
"""
|
||||
Error used to report that a file could not be read because it is written
|
||||
in an unsupported version of the file format.
|
||||
@ -67,7 +67,7 @@ class GrampsDbVersionError(Exception):
|
||||
"Gramps.\nPlease upgrade to the corresponding version or use "
|
||||
"XML for porting data between different database versions.")
|
||||
|
||||
class GrampsDbUpgradeRequiredError(Exception):
|
||||
class DbUpgradeRequiredError(Exception):
|
||||
"""
|
||||
Error used to report that a database needs to be upgraded before it can be
|
||||
used.
|
||||
|
@ -46,7 +46,7 @@ class CursorIterator(object):
|
||||
|
||||
# check for cancel
|
||||
#if self._status.should_cancel():
|
||||
# raise GrampsDbUserCancel
|
||||
# raise DbUserCancel
|
||||
|
||||
# emit heartbeat
|
||||
self._status.heartbeat()
|
||||
|
@ -49,7 +49,7 @@ from gen.lib import (MediaObject, Person, Family, Source, Event, Place,
|
||||
Repository, Note, GenderStats, Researcher)
|
||||
from gen.db.dbconst import *
|
||||
from gen.utils.callback import Callback
|
||||
from gen.db import (GrampsCursor, GrampsDbBase)
|
||||
from gen.db import (GrampsCursor, DbReadBase)
|
||||
from Utils import create_id
|
||||
import Errors
|
||||
import config
|
||||
@ -68,7 +68,7 @@ _SIGBASE = ('person', 'family', 'source', 'event',
|
||||
DBERRS = (db.DBRunRecoveryError, db.DBAccessError,
|
||||
db.DBPageNotFoundError, db.DBInvalidArgError)
|
||||
|
||||
class GrampsDbBookmarks(object):
|
||||
class DbBookmarks(object):
|
||||
def __init__(self, default=[]):
|
||||
self.bookmarks = list(default) # want a copy (not an alias)
|
||||
|
||||
@ -98,14 +98,14 @@ class GrampsDbBookmarks(object):
|
||||
# GrampsDBReadCursor
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class GrampsDbReadCursor(GrampsCursor):
|
||||
class DbReadCursor(GrampsCursor):
|
||||
|
||||
def __init__(self, source, txn=None, **kwargs):
|
||||
GrampsCursor.__init__(self, txn=txn, **kwargs)
|
||||
self.cursor = source.db.cursor(txn)
|
||||
self.source = source
|
||||
|
||||
class GrampsDbRead(GrampsDbBase, Callback):
|
||||
class DbBsddbRead(DbReadBase, Callback):
|
||||
"""
|
||||
Read class for the GRAMPS databases. Implements methods necessary to read
|
||||
the various object classes. Currently, there are eight (8) classes:
|
||||
@ -176,10 +176,10 @@ class GrampsDbRead(GrampsDbBase, Callback):
|
||||
|
||||
def __init__(self):
|
||||
"""
|
||||
Create a new GrampsDbRead instance.
|
||||
Create a new DbBsddbRead instance.
|
||||
"""
|
||||
|
||||
GrampsDbBase.__init__(self)
|
||||
DbReadBase.__init__(self)
|
||||
#Callback.__init__(self)
|
||||
|
||||
self.set_person_id_prefix('I%04d')
|
||||
@ -253,14 +253,14 @@ class GrampsDbRead(GrampsDbBase, Callback):
|
||||
self.default = None
|
||||
self.owner = Researcher()
|
||||
self.name_formats = []
|
||||
self.bookmarks = GrampsDbBookmarks()
|
||||
self.family_bookmarks = GrampsDbBookmarks()
|
||||
self.event_bookmarks = GrampsDbBookmarks()
|
||||
self.place_bookmarks = GrampsDbBookmarks()
|
||||
self.source_bookmarks = GrampsDbBookmarks()
|
||||
self.repo_bookmarks = GrampsDbBookmarks()
|
||||
self.media_bookmarks = GrampsDbBookmarks()
|
||||
self.note_bookmarks = GrampsDbBookmarks()
|
||||
self.bookmarks = DbBookmarks()
|
||||
self.family_bookmarks = DbBookmarks()
|
||||
self.event_bookmarks = DbBookmarks()
|
||||
self.place_bookmarks = DbBookmarks()
|
||||
self.source_bookmarks = DbBookmarks()
|
||||
self.repo_bookmarks = DbBookmarks()
|
||||
self.media_bookmarks = DbBookmarks()
|
||||
self.note_bookmarks = DbBookmarks()
|
||||
self._bm_changes = 0
|
||||
self.path = ""
|
||||
self.surname_list = []
|
||||
@ -284,7 +284,7 @@ class GrampsDbRead(GrampsDbBase, Callback):
|
||||
|
||||
def get_cursor(self, table, *args, **kwargs):
|
||||
try:
|
||||
return GrampsDbReadCursor(table, self.txn)
|
||||
return DbReadCursor(table, self.txn)
|
||||
except DBERRS, msg:
|
||||
self.__log_error()
|
||||
raise Errors.DbError(msg)
|
||||
@ -313,14 +313,6 @@ class GrampsDbRead(GrampsDbBase, Callback):
|
||||
def get_note_cursor(self, *args, **kwargs):
|
||||
return self.get_cursor(self.note_map, *args, **kwargs)
|
||||
|
||||
def load(self, name, callback, mode=DBMODE_R, upgrade=False):
|
||||
"""
|
||||
Open the specified database.
|
||||
|
||||
The method needs to be overridden in the derived class.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def close(self):
|
||||
"""
|
||||
Close the specified database.
|
||||
@ -608,14 +600,6 @@ class GrampsDbRead(GrampsDbBase, Callback):
|
||||
"""
|
||||
return self.name_group.has_key(str(name))
|
||||
|
||||
def set_name_group_mapping(self, name, group):
|
||||
"""
|
||||
Set the default grouping name for a surname.
|
||||
|
||||
Needs to be overridden in the derived class.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_number_of_records(self, table):
|
||||
if not self.db_is_open:
|
||||
return 0
|
||||
@ -991,40 +975,6 @@ class GrampsDbRead(GrampsDbBase, Callback):
|
||||
"""
|
||||
return self.surname_list
|
||||
|
||||
def build_surname_list(self):
|
||||
"""
|
||||
Build the list of locale-sorted surnames contained in the database.
|
||||
|
||||
The function must be overridden in the derived class.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def sort_surname_list(self):
|
||||
"""
|
||||
Sort the surname list in place.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def add_to_surname_list(self, person, batch_transaction):
|
||||
"""
|
||||
Check to see if the surname of the given person is already in
|
||||
the surname list.
|
||||
|
||||
If not then we need to add the name to the list.
|
||||
The function must be overridden in the derived class.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def remove_from_surname_list(self, person):
|
||||
"""
|
||||
Check whether there are persons with the same surname left in
|
||||
the database.
|
||||
|
||||
If not then we need to remove the name from the list.
|
||||
The function must be overridden in the derived class.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_bookmarks(self):
|
||||
"""Return the list of Person handles in the bookmarks."""
|
||||
return self.bookmarks
|
||||
@ -1466,15 +1416,6 @@ class GrampsDbRead(GrampsDbBase, Callback):
|
||||
"""
|
||||
return self.__get_columns(NOTE_COL_KEY)
|
||||
|
||||
def delete_primary_from_reference_map(self, handle, transaction):
|
||||
"""
|
||||
Called each time an object is removed from the database.
|
||||
|
||||
This can be used by subclasses to update any additional index tables
|
||||
that might need to be changed.
|
||||
"""
|
||||
pass
|
||||
|
||||
def find_backlink_handles(self, handle, include_classes=None):
|
||||
"""
|
||||
Find all objects that hold a reference to the object handle.
|
||||
@ -1557,8 +1498,3 @@ class GrampsDbRead(GrampsDbBase, Callback):
|
||||
"""
|
||||
return self._bm_changes > 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
x = GrampsDbRead()
|
||||
x.person_prefix = 'foo %s bar'
|
||||
print x.person_prefix
|
||||
|
||||
|
268
src/gen/db/test/db_test.py
Normal file
268
src/gen/db/test/db_test.py
Normal file
@ -0,0 +1,268 @@
|
||||
from gen.db import (DbReadBase, DbWriteBase,
|
||||
DbBsddbRead, DbBsddb)
|
||||
from gen.proxy.proxybase import ProxyDbBase
|
||||
from gen.proxy import LivingProxyDb
|
||||
|
||||
class DbTest(object):
|
||||
READ_METHODS = [
|
||||
"all_handles",
|
||||
"close",
|
||||
"create_id",
|
||||
"db_has_bm_changes",
|
||||
"find_backlink_handles",
|
||||
"find_initial_person",
|
||||
"find_next_event_gramps_id",
|
||||
"find_next_family_gramps_id",
|
||||
"find_next_note_gramps_id",
|
||||
"find_next_object_gramps_id",
|
||||
"find_next_person_gramps_id",
|
||||
"find_next_place_gramps_id",
|
||||
"find_next_repository_gramps_id",
|
||||
"find_next_source_gramps_id",
|
||||
"get_bookmarks",
|
||||
"get_child_column_order",
|
||||
"get_child_reference_types",
|
||||
"get_default_handle",
|
||||
"get_default_person",
|
||||
"get_event_bookmarks",
|
||||
"get_event_column_order",
|
||||
"get_event_cursor",
|
||||
"get_event_from_gramps_id",
|
||||
"get_event_from_handle",
|
||||
"get_event_handles",
|
||||
"get_event_roles",
|
||||
"get_family_attribute_types",
|
||||
"get_family_bookmarks",
|
||||
"get_family_cursor",
|
||||
"get_family_event_types",
|
||||
"get_family_from_gramps_id",
|
||||
"get_family_from_handle",
|
||||
"get_family_handles",
|
||||
"get_family_list_column_order",
|
||||
"get_family_relation_types",
|
||||
"get_from_handle",
|
||||
"get_gramps_ids",
|
||||
"get_marker_types",
|
||||
"get_media_attribute_types",
|
||||
"get_media_bookmarks",
|
||||
"get_media_column_order",
|
||||
"get_media_cursor",
|
||||
"get_media_object_handles",
|
||||
"get_mediapath",
|
||||
"get_name_group_keys",
|
||||
"get_name_group_mapping",
|
||||
"get_name_types",
|
||||
"get_note_bookmarks",
|
||||
"get_note_column_order",
|
||||
"get_note_cursor",
|
||||
"get_note_from_gramps_id",
|
||||
"get_note_from_handle",
|
||||
"get_note_handles",
|
||||
"get_note_types",
|
||||
"get_number_of_events",
|
||||
"get_number_of_families",
|
||||
"get_number_of_media_objects",
|
||||
"get_number_of_notes",
|
||||
"get_number_of_people",
|
||||
"get_number_of_places",
|
||||
"get_number_of_repositories",
|
||||
"get_number_of_sources",
|
||||
"get_object_from_gramps_id",
|
||||
"get_object_from_handle",
|
||||
"get_person_attribute_types",
|
||||
"get_person_column_order",
|
||||
"get_person_cursor",
|
||||
"get_person_event_types",
|
||||
"get_person_from_gramps_id",
|
||||
"get_person_from_handle",
|
||||
"get_person_handles",
|
||||
"get_place_bookmarks",
|
||||
"get_place_column_order",
|
||||
"get_place_cursor",
|
||||
"get_place_from_gramps_id",
|
||||
"get_place_from_handle",
|
||||
"get_place_handles",
|
||||
"get_raw_event_data",
|
||||
"get_raw_family_data",
|
||||
"get_raw_note_data",
|
||||
"get_raw_object_data",
|
||||
"get_raw_person_data",
|
||||
"get_raw_place_data",
|
||||
"get_raw_repository_data",
|
||||
"get_raw_source_data",
|
||||
"get_reference_map_cursor",
|
||||
"get_reference_map_primary_cursor",
|
||||
"get_reference_map_referenced_cursor",
|
||||
"get_repo_bookmarks",
|
||||
"get_repository_column_order",
|
||||
"get_repository_cursor",
|
||||
"get_repository_from_gramps_id",
|
||||
"get_repository_from_handle",
|
||||
"get_repository_handles",
|
||||
"get_repository_types",
|
||||
"get_researcher",
|
||||
"get_save_path",
|
||||
"get_source_bookmarks",
|
||||
"get_source_column_order",
|
||||
"get_source_cursor",
|
||||
"get_source_from_gramps_id",
|
||||
"get_source_from_handle",
|
||||
"get_source_handles",
|
||||
"get_source_media_types",
|
||||
"get_surname_list",
|
||||
"get_url_types",
|
||||
"gramps_upgrade",
|
||||
"has_event_handle",
|
||||
"has_family_handle",
|
||||
"has_gramps_id",
|
||||
"has_name_group_key",
|
||||
"has_note_handle",
|
||||
"has_object_handle",
|
||||
"has_person_handle",
|
||||
"has_place_handle",
|
||||
"has_repository_handle",
|
||||
"has_source_handle",
|
||||
"is_open",
|
||||
"iter_event_handles",
|
||||
"iter_events",
|
||||
"iter_families",
|
||||
"iter_family_handles",
|
||||
"iter_media_object_handles",
|
||||
"iter_media_objects",
|
||||
"iter_note_handles",
|
||||
"iter_notes",
|
||||
"iter_people",
|
||||
"iter_person_handles",
|
||||
"iter_place_handles",
|
||||
"iter_places",
|
||||
"iter_repositories",
|
||||
"iter_repository_handles",
|
||||
"iter_source_handles",
|
||||
"iter_sources",
|
||||
"load",
|
||||
"report_bm_change",
|
||||
"request_rebuild",
|
||||
# Prefix:
|
||||
"set_event_id_prefix",
|
||||
"set_family_id_prefix",
|
||||
"set_note_id_prefix",
|
||||
"set_object_id_prefix",
|
||||
"set_person_id_prefix",
|
||||
"set_place_id_prefix",
|
||||
"set_prefixes",
|
||||
"set_repository_id_prefix",
|
||||
"set_source_id_prefix",
|
||||
# Column order:
|
||||
"set_child_column_order",
|
||||
"set_column_order",
|
||||
"set_event_column_order",
|
||||
"set_family_list_column_order",
|
||||
"set_media_column_order",
|
||||
"set_note_column_order",
|
||||
"set_person_column_order",
|
||||
"set_place_column_order",
|
||||
"set_repository_column_order",
|
||||
"set_source_column_order",
|
||||
# Other set methods:
|
||||
"set_mediapath",
|
||||
"set_redo_callback",
|
||||
"set_researcher",
|
||||
"set_save_path",
|
||||
"set_undo_callback",
|
||||
|
||||
"version_supported",
|
||||
]
|
||||
|
||||
WRITE_METHODS = [
|
||||
"add_event",
|
||||
"add_family",
|
||||
"add_family_event",
|
||||
"add_note",
|
||||
"add_object",
|
||||
"add_person",
|
||||
"add_person_event",
|
||||
"add_place",
|
||||
"add_repository",
|
||||
"add_source",
|
||||
"add_to_surname_list",
|
||||
"build_surname_list",
|
||||
"commit_base",
|
||||
"commit_event",
|
||||
"commit_family",
|
||||
"commit_family_event",
|
||||
"commit_media_object",
|
||||
"commit_note",
|
||||
"commit_person",
|
||||
"commit_personal_event",
|
||||
"commit_place",
|
||||
"commit_repository",
|
||||
"commit_source",
|
||||
"delete_primary_from_reference_map",
|
||||
"need_upgrade",
|
||||
"rebuild_secondary",
|
||||
"reindex_reference_map",
|
||||
"remove_event",
|
||||
"remove_family",
|
||||
"remove_from_surname_list",
|
||||
"remove_note",
|
||||
"remove_object",
|
||||
"remove_person",
|
||||
"remove_place",
|
||||
"remove_repository",
|
||||
"remove_source",
|
||||
"set_auto_remove",
|
||||
"set_default_person_handle",
|
||||
"set_name_group_mapping",
|
||||
"sort_surname_list",
|
||||
"transaction_begin",
|
||||
"transaction_commit",
|
||||
"update_reference_map",
|
||||
"write_version",
|
||||
]
|
||||
|
||||
def __init__(self, db):
|
||||
self.db = db
|
||||
|
||||
def _verify_readonly(self):
|
||||
print "Verifying readonly", self.db.__class__.__name__
|
||||
for method in self.READ_METHODS:
|
||||
assert hasattr(self.db, method), \
|
||||
("readonly should have a '%s' method" % method)
|
||||
for method in self.WRITE_METHODS:
|
||||
assert not hasattr(self.db, method), \
|
||||
("readonly should NOT have a '%s' method" % method)
|
||||
print "passed!"
|
||||
|
||||
def _verify_readwrite(self):
|
||||
print "Verifying readwrite", self.db.__class__.__name__
|
||||
for method in self.READ_METHODS:
|
||||
assert hasattr(self.db, method), \
|
||||
("readwrite should have a '%s' method" % method)
|
||||
for method in self.WRITE_METHODS:
|
||||
assert hasattr(self.db, method), \
|
||||
("readwrite should have a '%s' method" % method)
|
||||
print "passed!"
|
||||
|
||||
db1 = DbTest(DbReadBase())
|
||||
db1._verify_readonly()
|
||||
|
||||
db2 = DbTest(DbWriteBase())
|
||||
db2._verify_readwrite()
|
||||
|
||||
from gen.db import DbBsddbRead
|
||||
db3 = DbTest(DbBsddbRead())
|
||||
db3._verify_readonly()
|
||||
|
||||
from gen.db import DbBsddb
|
||||
db4 = DbTest(DbBsddb())
|
||||
db4._verify_readwrite()
|
||||
|
||||
from gen.proxy.proxybase import ProxyDbBase
|
||||
gdb = DbBsddb()
|
||||
db5 = DbTest(ProxyDbBase(gdb))
|
||||
db5._verify_readonly()
|
||||
|
||||
from gen.proxy import LivingProxyDb
|
||||
gdb = DbBsddb()
|
||||
db6 = DbTest(LivingProxyDb(gdb, LivingProxyDb.MODE_EXCLUDE_ALL))
|
||||
db6._verify_readonly()
|
@ -21,7 +21,7 @@
|
||||
# $Id$
|
||||
|
||||
"""
|
||||
Exports the GrampsDbTxn class for managing Gramps transactions and the undo
|
||||
Exports the DbTxn class for managing Gramps transactions and the undo
|
||||
database.
|
||||
"""
|
||||
|
||||
@ -51,7 +51,7 @@ _LOG = logging.getLogger(DBLOGNAME)
|
||||
# Gramps transaction class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class GrampsDbTxn(dict):
|
||||
class DbTxn(dict):
|
||||
"""
|
||||
Define a group of database commits that define a single logical operation.
|
||||
This class should not be used directly, but subclassed to reference a real
|
||||
@ -86,10 +86,10 @@ class GrampsDbTxn(dict):
|
||||
Create a new transaction.
|
||||
|
||||
A Transaction instance should not be created directly, but by the
|
||||
GrampsDbBase class or classes derived from GrampsDbBase. The commitdb
|
||||
DbBase class or classes derived from DbBase. The commitdb
|
||||
parameter is a list-like interface that stores the commit data. This
|
||||
could be a simple list, or a RECNO-style database object. The grampsdb
|
||||
parameter is a reference to the GrampsDbWrite object to which this
|
||||
parameter is a reference to the DbWrite object to which this
|
||||
transaction will be applied.
|
||||
|
||||
The data structure used to handle the transactions is a Python
|
||||
@ -108,7 +108,7 @@ class GrampsDbTxn(dict):
|
||||
data = pickled representation of the object
|
||||
"""
|
||||
|
||||
super(GrampsDbTxn, self).__init__({})
|
||||
super(DbTxn, self).__init__({})
|
||||
|
||||
self.msg = msg
|
||||
self.commitdb = commitdb
|
||||
@ -298,7 +298,7 @@ def testtxn():
|
||||
""" Fake commit database"""
|
||||
pass
|
||||
|
||||
class G(GrampsDbTxn):
|
||||
class G(DbTxn):
|
||||
"""Derived transacton class"""
|
||||
def get_db_txn(self, env):
|
||||
return T()
|
||||
|
@ -21,7 +21,7 @@
|
||||
# $Id$
|
||||
|
||||
"""
|
||||
Exports the GrampsDbUndo class for managing Gramps transactions
|
||||
Exports the DbUndo class for managing Gramps transactions
|
||||
undos and redos.
|
||||
"""
|
||||
|
||||
@ -57,10 +57,10 @@ _SIGBASE = ('person', 'family', 'source', 'event', 'media',
|
||||
'place', 'repository', 'reference', 'note')
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GrampsDbUndo class
|
||||
# DbUndo class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class GrampsDbUndo(object):
|
||||
class DbUndo(object):
|
||||
"""
|
||||
Base class for the gramps undo/redo manager. Needs to be subclassed
|
||||
for use with a real backend.
|
||||
@ -333,7 +333,7 @@ class GrampsDbUndo(object):
|
||||
self.db._log_error()
|
||||
raise Errors.DbError(msg)
|
||||
|
||||
class GrampsDbUndoList(GrampsDbUndo):
|
||||
class DbUndoList(DbUndo):
|
||||
"""
|
||||
Implementation of the gramps undo database using a Python list
|
||||
"""
|
||||
@ -341,7 +341,7 @@ class GrampsDbUndoList(GrampsDbUndo):
|
||||
"""
|
||||
Class constructor
|
||||
"""
|
||||
super(GrampsDbUndoList, self).__init__(grampsdb)
|
||||
super(DbUndoList, self).__init__(grampsdb)
|
||||
self.undodb = []
|
||||
|
||||
def open(self):
|
||||
@ -389,7 +389,7 @@ class GrampsDbUndoList(GrampsDbUndo):
|
||||
"""
|
||||
return len(self.undodb)
|
||||
|
||||
class GrampsDbUndoBSDDB(GrampsDbUndo):
|
||||
class DbUndoBSDDB(DbUndo):
|
||||
"""
|
||||
Class constructor for gramps undo/redo database using a bsddb recno
|
||||
database as the backing store.
|
||||
@ -399,7 +399,7 @@ class GrampsDbUndoBSDDB(GrampsDbUndo):
|
||||
"""
|
||||
Class constructor
|
||||
"""
|
||||
super(GrampsDbUndoBSDDB, self).__init__(grampsdb)
|
||||
super(DbUndoBSDDB, self).__init__(grampsdb)
|
||||
self.undodb = db.DB()
|
||||
self.path = path
|
||||
|
||||
@ -478,7 +478,7 @@ def testundo():
|
||||
self.reference_map = {}
|
||||
|
||||
print "list tests"
|
||||
undo = GrampsDbUndoList(D())
|
||||
undo = DbUndoList(D())
|
||||
print undo.append('foo')
|
||||
print undo.append('bar')
|
||||
print undo[0]
|
||||
@ -490,7 +490,7 @@ def testundo():
|
||||
print data
|
||||
print
|
||||
print "bsddb tests"
|
||||
undo = GrampsDbUndoBSDDB(D(), '/tmp/testundo')
|
||||
undo = DbUndoBSDDB(D(), '/tmp/testundo')
|
||||
undo.open()
|
||||
print undo.append('foo')
|
||||
print undo.append('fo2')
|
||||
|
@ -21,7 +21,7 @@
|
||||
# $Id$
|
||||
|
||||
"""
|
||||
Provide the Berkeley DB (DBDir) database backend for GRAMPS.
|
||||
Provide the Berkeley DB (DbBsddb) database backend for GRAMPS.
|
||||
This is used since GRAMPS version 3.0
|
||||
"""
|
||||
|
||||
@ -50,9 +50,10 @@ from sys import maxint
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.lib import (GenderStats, Person, Family, Event, Place, Source,
|
||||
MediaObject, Repository, Note)
|
||||
from gen.db import (GrampsDbRead, BSDDBTxn, GrampsDbTxn, GrampsCursor,
|
||||
GrampsDbVersionError, GrampsDbUpgradeRequiredError,
|
||||
GrampsDbUndoBSDDB as GrampsDbUndo)
|
||||
from gen.db import (DbBsddbRead, DbWriteBase, BSDDBTxn,
|
||||
DbTxn, GrampsCursor,DbVersionError,
|
||||
DbUpgradeRequiredError,
|
||||
DbUndoBSDDB as DbUndo)
|
||||
from gen.db.dbconst import *
|
||||
from gen.utils.callback import Callback
|
||||
from BasicUtils import UpdateCallback
|
||||
@ -151,10 +152,10 @@ class GrampsWriteCursor(GrampsCursor):
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GrampsDBDirAssocCursor
|
||||
# DbBsddbAssocCursor
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class GrampsDBDirAssocCursor(GrampsCursor):
|
||||
class DbBsddbAssocCursor(GrampsCursor):
|
||||
|
||||
def __init__(self, source, txn=None, **kwargs):
|
||||
GrampsCursor.__init__(self, txn=txn, **kwargs)
|
||||
@ -163,10 +164,11 @@ class GrampsDBDirAssocCursor(GrampsCursor):
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GrampsDBDir
|
||||
# DbBsddb
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class GrampsDBDir(GrampsDbRead, Callback, UpdateCallback):
|
||||
class DbBsddb(DbBsddbRead, DbWriteBase,
|
||||
Callback, UpdateCallback):
|
||||
"""
|
||||
GRAMPS database write access object.
|
||||
"""
|
||||
@ -197,7 +199,7 @@ class GrampsDBDir(GrampsDbRead, Callback, UpdateCallback):
|
||||
"""Create a new GrampsDB."""
|
||||
|
||||
self.txn = None
|
||||
GrampsDbRead.__init__(self)
|
||||
DbBsddbRead.__init__(self)
|
||||
Callback.__init__(self)
|
||||
self.secondary_connected = False
|
||||
self.has_changed = False
|
||||
@ -279,14 +281,14 @@ class GrampsDBDir(GrampsDbRead, Callback, UpdateCallback):
|
||||
"""
|
||||
Returns a reference to a cursor over the reference map
|
||||
"""
|
||||
return GrampsDBDirAssocCursor(self.reference_map, self.txn)
|
||||
return DbBsddbAssocCursor(self.reference_map, self.txn)
|
||||
|
||||
@catch_db_error
|
||||
def get_reference_map_primary_cursor(self):
|
||||
"""
|
||||
Returns a reference to a cursor over the reference map primary map
|
||||
"""
|
||||
return GrampsDBDirAssocCursor(self.reference_map_primary_map,
|
||||
return DbBsddbAssocCursor(self.reference_map_primary_map,
|
||||
self.txn)
|
||||
|
||||
@catch_db_error
|
||||
@ -294,10 +296,10 @@ class GrampsDBDir(GrampsDbRead, Callback, UpdateCallback):
|
||||
"""
|
||||
Returns a reference to a cursor over the reference map referenced map
|
||||
"""
|
||||
return GrampsDBDirAssocCursor(self.reference_map_referenced_map,
|
||||
return DbBsddbAssocCursor(self.reference_map_referenced_map,
|
||||
self.txn)
|
||||
|
||||
# These are overriding the GrampsDbRead's methods of saving metadata
|
||||
# These are overriding the DbBsddbRead's methods of saving metadata
|
||||
# because we now have txn-capable metadata table
|
||||
|
||||
@catch_db_error
|
||||
@ -376,7 +378,7 @@ class GrampsDBDir(GrampsDbRead, Callback, UpdateCallback):
|
||||
self.close()
|
||||
|
||||
self.readonly = mode == DBMODE_R
|
||||
#super(GrampsDbRead, self).load(name, callback, mode)
|
||||
#super(DbBsddbRead, self).load(name, callback, mode)
|
||||
if callback:
|
||||
callback(12)
|
||||
|
||||
@ -419,7 +421,7 @@ class GrampsDBDir(GrampsDbRead, Callback, UpdateCallback):
|
||||
# it makes no sense to go further
|
||||
if not self.version_supported():
|
||||
self.__close_early()
|
||||
raise GrampsDbVersionError()
|
||||
raise DbVersionError()
|
||||
|
||||
self.__load_metadata()
|
||||
gstats = self.metadata.get('gender_stats', default=None)
|
||||
@ -473,7 +475,7 @@ class GrampsDBDir(GrampsDbRead, Callback, UpdateCallback):
|
||||
self.gramps_upgrade(callback)
|
||||
else:
|
||||
self.__close_early()
|
||||
raise GrampsDbUpgradeRequiredError()
|
||||
raise DbUpgradeRequiredError()
|
||||
|
||||
if callback:
|
||||
callback(50)
|
||||
@ -501,7 +503,7 @@ class GrampsDBDir(GrampsDbRead, Callback, UpdateCallback):
|
||||
"""
|
||||
if not self.readonly:
|
||||
self.undolog = os.path.join(self.full_name, DBUNDOFN)
|
||||
self.undodb = GrampsDbUndo(self, self.undolog)
|
||||
self.undodb = DbUndo(self, self.undolog)
|
||||
self.undodb.open()
|
||||
|
||||
def __close_undodb(self):
|
||||
@ -1719,7 +1721,7 @@ class GrampsDBDir(GrampsDbRead, Callback, UpdateCallback):
|
||||
# BdbTransaction
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class BdbTransaction(GrampsDbTxn):
|
||||
class BdbTransaction(DbTxn):
|
||||
"""
|
||||
The batch parameter is set to True for large transactions. For such
|
||||
transactions, the list of changes is not maintained, and no undo
|
||||
@ -1735,7 +1737,7 @@ class BdbTransaction(GrampsDbTxn):
|
||||
__slots__ = ('batch', 'no_magic')
|
||||
|
||||
def __init__(self, msg, undodb, grampsdb, batch=False, no_magic=False):
|
||||
GrampsDbTxn.__init__(self, msg, undodb, grampsdb)
|
||||
DbTxn.__init__(self, msg, undodb, grampsdb)
|
||||
self.batch = batch
|
||||
self.no_magic = no_magic
|
||||
|
||||
@ -1774,7 +1776,7 @@ if __name__ == "__main__":
|
||||
|
||||
import os, sys, pdb
|
||||
|
||||
d = GrampsDBDir()
|
||||
d = DbBsddb()
|
||||
if len(sys.argv) > 1:
|
||||
db_name = sys.argv[1]
|
||||
else:
|
||||
|
@ -416,7 +416,7 @@ def copy_media_ref_list(db, original_obj, clean_obj):
|
||||
references and references to private objects.
|
||||
|
||||
@param db: GRAMPS database to which the references belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param original_obj: Object that may have private references
|
||||
@type original_obj: MediaBase
|
||||
@param clean_obj: Object that will have only non-private references
|
||||
@ -436,7 +436,7 @@ def copy_source_ref_list(db, original_obj, clean_obj):
|
||||
references and references to private objects.
|
||||
|
||||
@param db: GRAMPS database to which the references belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param original_obj: Object that may have private references
|
||||
@type original_obj: SourceBase
|
||||
@param clean_obj: Object that will have only non-private references
|
||||
@ -456,7 +456,7 @@ def copy_notes(db, original_obj, clean_obj):
|
||||
notes.
|
||||
|
||||
@param db: GRAMPS database to which the references belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param original_obj: Object that may have private references
|
||||
@type original_obj: NoteBase
|
||||
@param clean_obj: Object that will have only non-private references
|
||||
@ -474,7 +474,7 @@ def copy_attributes(db, original_obj, clean_obj):
|
||||
private attributes.
|
||||
|
||||
@param db: GRAMPS database to which the references belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param original_obj: Object that may have private references
|
||||
@type original_obj: AttributeBase
|
||||
@param clean_obj: Object that will have only non-private references
|
||||
@ -496,7 +496,7 @@ def copy_urls(db, original_obj, clean_obj):
|
||||
private urls.
|
||||
|
||||
@param db: GRAMPS database to which the references belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param original_obj: Object that may have urls
|
||||
@type original_obj: UrlBase
|
||||
@param clean_obj: Object that will have only non-private urls
|
||||
@ -513,7 +513,7 @@ def copy_lds_ords(db, original_obj, clean_obj):
|
||||
private LDS ORDs.
|
||||
|
||||
@param db: GRAMPS database to which the references belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param original_obj: Object that may have LDS ORDs
|
||||
@type original_obj: LdsOrdBase
|
||||
@param clean_obj: Object that will have only non-private LDS ORDs
|
||||
@ -530,7 +530,7 @@ def copy_addresses(db, original_obj, clean_obj):
|
||||
private addresses.
|
||||
|
||||
@param db: GRAMPS database to which the references belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param original_obj: Object that may have addresses
|
||||
@type original_obj: AddressBase
|
||||
@param clean_obj: Object that will have only non-private addresses
|
||||
@ -548,7 +548,7 @@ def sanitize_lds_ord(db, lds_ord):
|
||||
removed from it.
|
||||
|
||||
@param db: GRAMPS database to which the LdsOrd object belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param name: source LdsOrd object that will be copied with
|
||||
privacy records removed
|
||||
@type name: LdsOrd
|
||||
@ -584,7 +584,7 @@ def sanitize_address(db, address):
|
||||
removed from it.
|
||||
|
||||
@param db: GRAMPS database to which the Person object belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param name: source Address object that will be copied with
|
||||
privacy records removed
|
||||
@type name: Address
|
||||
@ -614,7 +614,7 @@ def sanitize_name(db, name):
|
||||
removed from it.
|
||||
|
||||
@param db: GRAMPS database to which the Person object belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param name: source Name object that will be copied with
|
||||
privacy records removed
|
||||
@type name: Name
|
||||
@ -647,7 +647,7 @@ def sanitize_media_ref(db, media_ref):
|
||||
removed from it.
|
||||
|
||||
@param db: GRAMPS database to which the MediaRef object belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param source_ref: source MediaRef object that will be copied with
|
||||
privacy records removed
|
||||
@type source_ref: MediaRef
|
||||
@ -671,7 +671,7 @@ def sanitize_source_ref(db, source_ref):
|
||||
removed from it.
|
||||
|
||||
@param db: GRAMPS database to which the Person object belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param source_ref: source SourceRef object that will be copied with
|
||||
privacy records removed
|
||||
@type source_ref: SourceRef
|
||||
@ -694,7 +694,7 @@ def sanitize_event_ref(db, event_ref):
|
||||
removed from it.
|
||||
|
||||
@param db: GRAMPS database to which the Person object belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param event_ref: source EventRef object that will be copied with
|
||||
privacy records removed
|
||||
@type event_ref: EventRef
|
||||
@ -717,7 +717,7 @@ def sanitize_person(db, person):
|
||||
removed from it.
|
||||
|
||||
@param db: GRAMPS database to which the Person object belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param person: source Person object that will be copied with
|
||||
privacy records removed
|
||||
@type person: Person
|
||||
@ -806,7 +806,7 @@ def sanitize_source(db, source):
|
||||
removed from it.
|
||||
|
||||
@param db: GRAMPS database to which the Person object belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param source: source Source object that will be copied with
|
||||
privacy records removed
|
||||
@type source: Source
|
||||
@ -844,7 +844,7 @@ def sanitize_media(db, media):
|
||||
removed from it.
|
||||
|
||||
@param db: GRAMPS database to which the Person object belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param media: source Media object that will be copied with
|
||||
privacy records removed
|
||||
@type media: MediaObject
|
||||
@ -875,7 +875,7 @@ def sanitize_place(db, place):
|
||||
removed from it.
|
||||
|
||||
@param db: GRAMPS database to which the Person object belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param place: source Place object that will be copied with
|
||||
privacy records removed
|
||||
@type place: Place
|
||||
@ -908,7 +908,7 @@ def sanitize_event(db, event):
|
||||
removed from it.
|
||||
|
||||
@param db: GRAMPS database to which the Person object belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param event: source Event object that will be copied with
|
||||
privacy records removed
|
||||
@type event: Event
|
||||
@ -944,7 +944,7 @@ def sanitize_family(db, family):
|
||||
removed from it.
|
||||
|
||||
@param db: GRAMPS database to which the Person object belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param family: source Family object that will be copied with
|
||||
privacy records removed
|
||||
@type family: Family
|
||||
@ -1012,7 +1012,7 @@ def sanitize_repository(db, repository):
|
||||
removed from it.
|
||||
|
||||
@param db: GRAMPS database to which the Person object belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param repository: source Repository object that will be copied with
|
||||
privacy records removed
|
||||
@type repository: Repository
|
||||
|
@ -30,15 +30,16 @@ Proxy class for the GRAMPS databases. Filter out all data marked private.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from itertools import ifilter
|
||||
import types
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS libraries
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.db.base import GrampsDbBase
|
||||
from gen.db.base import DbReadBase, DbWriteBase
|
||||
|
||||
class ProxyDbBase(GrampsDbBase):
|
||||
class ProxyDbBase(DbReadBase):
|
||||
"""
|
||||
ProxyDbBase is a base class for building a proxy to a Gramps database.
|
||||
This class attempts to implement functions that are likely to be common
|
||||
@ -323,8 +324,12 @@ class ProxyDbBase(GrampsDbBase):
|
||||
setattr(self, name, attr)
|
||||
return attr
|
||||
|
||||
# if a write-method:
|
||||
if (name in DbWriteBase.__dict__ and
|
||||
not name.startswith("__") and
|
||||
type(DbWriteBase.__dict__[name]) is types.FunctionType):
|
||||
raise AttributeError
|
||||
# Default behaviour: lookup attribute in parent object
|
||||
|
||||
return getattr(self.db, name)
|
||||
|
||||
def get_person_from_handle(self, handle):
|
||||
@ -678,29 +683,6 @@ class ProxyDbBase(GrampsDbBase):
|
||||
"""returns the default media path of the database"""
|
||||
return self.db.get_mediapath()
|
||||
|
||||
def find_backlink_handles(self, handle, include_classes=None):
|
||||
"""
|
||||
Find all objects that hold a reference to the object handle.
|
||||
Returns an iterator over a list of (class_name, handle) tuples.
|
||||
|
||||
@param handle: handle of the object to search for.
|
||||
@type handle: database handle
|
||||
@param include_classes: list of class names to include in the results.
|
||||
Default: None means include all classes.
|
||||
@type include_classes: list of class names
|
||||
|
||||
This default implementation does a sequential scan through all
|
||||
the primary object databases and is very slow. Backends can
|
||||
override this method to provide much faster implementations that
|
||||
make use of additional capabilities of the backend.
|
||||
|
||||
Note that this is a generator function, it returns a iterator for
|
||||
use in loops. If you want a list of the results use:
|
||||
|
||||
> result_list = list(find_backlink_handles(handle))
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_gramps_ids(self, obj_key):
|
||||
return self.db.get_gramps_ids(obj_key)
|
||||
|
||||
|
@ -105,7 +105,7 @@ class CallbackManager(object):
|
||||
"""
|
||||
:param database: database to which to connect the callbacks of this
|
||||
CallbackManager object
|
||||
:type database: a class:`~gen.db.base.GrampsDbBase` object
|
||||
:type database: a class:`~gen.db.base.DbBase` object
|
||||
"""
|
||||
#no handles to track
|
||||
self.database = database
|
||||
@ -261,7 +261,7 @@ class CallbackManager(object):
|
||||
Execute a specific callback. This is only actually done if one of the
|
||||
registered handles is involved.
|
||||
Arg must conform to the requirements of the signal emitter.
|
||||
For a GrampsDbBase that is that arg must be not given (rebuild
|
||||
For a DbBase that is that arg must be not given (rebuild
|
||||
methods), or arg[0] must be the list of handles affected.
|
||||
"""
|
||||
key = signal.split('-')[0]
|
||||
|
@ -277,7 +277,7 @@ class DbLoader(CLIDbLoader):
|
||||
else:
|
||||
mode = 'w'
|
||||
|
||||
self.dbstate.change_database(gen.db.GrampsDBDir())
|
||||
self.dbstate.change_database(gen.db.DbBsddb())
|
||||
self.dbstate.db.disable_signals()
|
||||
|
||||
self._begin_progress()
|
||||
@ -286,7 +286,7 @@ class DbLoader(CLIDbLoader):
|
||||
try:
|
||||
self.dbstate.db.load(filename, self._pulse_progress,
|
||||
mode, upgrade=False)
|
||||
except gen.db.exceptions.GrampsDbUpgradeRequiredError, msg:
|
||||
except gen.db.exceptions.DbUpgradeRequiredError, msg:
|
||||
if QuestionDialog2(_("Need to upgrade database!"),
|
||||
str(msg),
|
||||
_("Upgrade now"),
|
||||
@ -296,7 +296,7 @@ class DbLoader(CLIDbLoader):
|
||||
self.dbstate.db.set_save_path(filename)
|
||||
else:
|
||||
self.dbstate.no_database()
|
||||
except gen.db.exceptions.GrampsDbVersionError, msg:
|
||||
except gen.db.exceptions.DbVersionError, msg:
|
||||
self.dbstate.no_database()
|
||||
self._errordialog( _("Cannot open database"), str(msg))
|
||||
except OSError, msg:
|
||||
|
@ -68,14 +68,14 @@ import pango
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from QuestionDialog import ErrorDialog, QuestionDialog
|
||||
from gen.db import GrampsDBDir
|
||||
from gen.db import DbBsddb
|
||||
from gui.pluginmanager import GuiPluginManager
|
||||
from cli.clidbman import CLIDbManager, NAME_FILE, time_val
|
||||
from DdTargets import DdTargets
|
||||
import RecentFiles
|
||||
from glade import Glade
|
||||
from gen.db.backup import restore
|
||||
from gen.db.exceptions import GrampsDbException
|
||||
from gen.db.exceptions import DbException
|
||||
|
||||
_RETURN = gtk.gdk.keyval_from_name("Return")
|
||||
_KP_ENTER = gtk.gdk.keyval_from_name("KP_Enter")
|
||||
@ -509,7 +509,7 @@ class DbManager(CLIDbManager):
|
||||
new_path, newname = self._create_new_db("%s : %s" % (parent_name, name))
|
||||
|
||||
self.__start_cursor(_("Extracting archive..."))
|
||||
dbclass = GrampsDBDir
|
||||
dbclass = DbBsddb
|
||||
dbase = dbclass()
|
||||
dbase.load(new_path, None)
|
||||
|
||||
@ -633,10 +633,10 @@ class DbManager(CLIDbManager):
|
||||
fname = os.path.join(dirname, filename)
|
||||
os.unlink(fname)
|
||||
|
||||
newdb = GrampsDBDir()
|
||||
newdb = DbBsddb()
|
||||
newdb.write_version(dirname)
|
||||
|
||||
dbclass = GrampsDBDir
|
||||
dbclass = DbBsddb
|
||||
dbase = dbclass()
|
||||
dbase.set_save_path(dirname)
|
||||
dbase.load(dirname, None)
|
||||
@ -645,7 +645,7 @@ class DbManager(CLIDbManager):
|
||||
|
||||
try:
|
||||
restore(dbase)
|
||||
except GrampsDbException, msg:
|
||||
except DbException, msg:
|
||||
ErrorDialog(_("Error restoring backup data"), msg)
|
||||
|
||||
self.__end_cursor()
|
||||
|
@ -79,7 +79,7 @@ from gui.dbloader import DbLoader
|
||||
import GrampsDisplay
|
||||
from gen.utils import ProgressMonitor
|
||||
from gen.db.backup import backup
|
||||
from gen.db.exceptions import GrampsDbException
|
||||
from gen.db.exceptions import DbException
|
||||
from GrampsAboutDialog import GrampsAboutDialog
|
||||
import ProgressDialog
|
||||
|
||||
@ -700,7 +700,7 @@ class ViewManager(CLIManager):
|
||||
self.uistate.push_message(self.dbstate, _("Autobackup..."))
|
||||
try:
|
||||
backup(self.dbstate.db)
|
||||
except GrampsDbException, msg:
|
||||
except DbException, msg:
|
||||
ErrorDialog(_("Error saving backup data"), msg)
|
||||
self.uistate.set_busy_cursor(0)
|
||||
self.uistate.progress.hide()
|
||||
|
@ -197,7 +197,7 @@ def estimate_age(db, person, end_handle=None, start_handle=None, today=_TODAY):
|
||||
the birth or death date is missing, a (-1, -1) is returned.
|
||||
|
||||
@param db: GRAMPS database to which the Person object belongs
|
||||
@type db: GrampsDbBase
|
||||
@type db: DbBase
|
||||
@param person: Person object to calculate the age of
|
||||
@type person: Person
|
||||
@param end_handle: Determines the event handle that determines
|
||||
|
@ -57,7 +57,7 @@ log = logging.getLogger(".WriteXML")
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
from BasicUtils import UpdateCallback
|
||||
from gen.db.exceptions import GrampsDbWriteFailure
|
||||
from gen.db.exceptions import DbWriteFailure
|
||||
import const
|
||||
from QuestionDialog import ErrorDialog
|
||||
from ExportOptions import WriterOptionBox
|
||||
@ -87,7 +87,7 @@ def escxml(d):
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class GrampsDbXmlWriter(UpdateCallback):
|
||||
class GrampsXmlWriter(UpdateCallback):
|
||||
"""
|
||||
Writes a database to the XML file.
|
||||
"""
|
||||
@ -121,7 +121,7 @@ class GrampsDbXmlWriter(UpdateCallback):
|
||||
base = os.path.dirname(filename)
|
||||
if os.path.isdir(base):
|
||||
if not os.access(base, os.W_OK) or not os.access(base, os.R_OK):
|
||||
raise GrampsDbWriteFailure(
|
||||
raise DbWriteFailure(
|
||||
_('Failure writing %s') % filename,
|
||||
_("The database cannot be saved because you do "
|
||||
"not have permission to write to the directory. "
|
||||
@ -131,7 +131,7 @@ class GrampsDbXmlWriter(UpdateCallback):
|
||||
|
||||
if os.path.exists(filename):
|
||||
if not os.access(filename, os.W_OK):
|
||||
raise GrampsDbWriteFailure(
|
||||
raise DbWriteFailure(
|
||||
_('Failure writing %s') % filename,
|
||||
_("The database cannot be saved because you do "
|
||||
"not have permission to write to the file. "
|
||||
@ -150,7 +150,7 @@ class GrampsDbXmlWriter(UpdateCallback):
|
||||
g = open(filename,"w")
|
||||
except IOError,msg:
|
||||
print str(msg)
|
||||
raise GrampsDbWriteFailure((_('Failure writing %s') % filename,
|
||||
raise DbWriteFailure((_('Failure writing %s') % filename,
|
||||
str(msg)))
|
||||
return 0
|
||||
|
||||
@ -1189,13 +1189,13 @@ def export_data(database, filename, option_box=None, callback=None):
|
||||
# XmlWriter
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class XmlWriter(GrampsDbXmlWriter):
|
||||
class XmlWriter(GrampsXmlWriter):
|
||||
"""
|
||||
Writes a database to the XML file.
|
||||
"""
|
||||
|
||||
def __init__(self, dbase, callback, strip_photos, compress=1):
|
||||
GrampsDbXmlWriter.__init__(
|
||||
GrampsXmlWriter.__init__(
|
||||
self, dbase, strip_photos, compress, const.VERSION, callback)
|
||||
|
||||
def write(self, filename):
|
||||
@ -1204,8 +1204,8 @@ class XmlWriter(GrampsDbXmlWriter):
|
||||
"""
|
||||
ret = 0 #False
|
||||
try:
|
||||
ret = GrampsDbXmlWriter.write(self, filename)
|
||||
except GrampsDbWriteFailure, msg:
|
||||
ret = GrampsXmlWriter.write(self, filename)
|
||||
except DbWriteFailure, msg:
|
||||
(m1,m2) = msg.messages()
|
||||
ErrorDialog(m1, m2)
|
||||
return ret
|
||||
|
@ -38,7 +38,7 @@ import cPickle as pickle
|
||||
import time
|
||||
from bsddb import dbshelve, db
|
||||
import logging
|
||||
__LOG = logging.getLogger(".GrampsDb")
|
||||
__LOG = logging.getLogger(".Db")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -48,12 +48,12 @@ __LOG = logging.getLogger(".GrampsDb")
|
||||
from gen.lib import (GenderStats, Source, Person, Family, Event, Place,
|
||||
MediaObject, Repository, Note, Attribute, AttributeType,
|
||||
NoteType)
|
||||
from gen.db.write import (GrampsDBDir, KEY_TO_CLASS_MAP, CLASS_TO_KEY_MAP)
|
||||
from libgrdb import GrampsDbGrdb
|
||||
from gen.db.txn import GrampsDbTxn as Transaction
|
||||
from gen.db.write import (DbBsddb, KEY_TO_CLASS_MAP, CLASS_TO_KEY_MAP)
|
||||
from libgrdb import DbGrdb
|
||||
from gen.db.txn import DbTxn as Transaction
|
||||
from gen.db.cursor import GrampsCursor
|
||||
from gen.db.dbconst import *
|
||||
from gen.db.exceptions import GrampsDbVersionError
|
||||
from gen.db.exceptions import DbVersionError
|
||||
import const
|
||||
from QuestionDialog import ErrorDialog
|
||||
from Errors import HandleError
|
||||
@ -133,7 +133,7 @@ class GrampsBSDDBDupCursor(GrampsBSDDBAssocCursor):
|
||||
# GrampsBSDDB
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class GrampsBSDDB(GrampsDbGrdb, UpdateCallback):
|
||||
class GrampsBSDDB(DbGrdb, UpdateCallback):
|
||||
""" GRAMPS database object for Berkeley DB.
|
||||
This is replaced for internal use by gen/db/dbdir.py
|
||||
However, this class is still used for import of the 2.2.x
|
||||
@ -143,7 +143,7 @@ class GrampsBSDDB(GrampsDbGrdb, UpdateCallback):
|
||||
def __init__(self, use_txn = True):
|
||||
"""creates a new GrampsDB"""
|
||||
|
||||
GrampsDbGrdb.__init__(self)
|
||||
DbGrdb.__init__(self)
|
||||
#UpdateCallback.__init__(self)
|
||||
self.txn = None
|
||||
self.secondary_connected = False
|
||||
@ -304,7 +304,7 @@ class GrampsBSDDB(GrampsDbGrdb, UpdateCallback):
|
||||
def get_reference_map_referenced_cursor(self):
|
||||
return GrampsBSDDBDupCursor(self.reference_map_referenced_map, self.txn)
|
||||
|
||||
# These are overriding the GrampsDbBase's methods of saving metadata
|
||||
# These are overriding the DbBase's methods of saving metadata
|
||||
# because we now have txn-capable metadata table
|
||||
def set_default_person_handle(self, handle):
|
||||
"""sets the default Person to the passed instance"""
|
||||
@ -1119,7 +1119,7 @@ class GrampsBSDDB(GrampsDbGrdb, UpdateCallback):
|
||||
self.metadata = None
|
||||
self.env = None
|
||||
self.db_is_open = False
|
||||
raise GrampsDbVersionError()
|
||||
raise DbVersionError()
|
||||
|
||||
def close(self):
|
||||
if not self.db_is_open:
|
||||
@ -1475,7 +1475,7 @@ class GrampsBSDDB(GrampsDbGrdb, UpdateCallback):
|
||||
else:
|
||||
self.txn = None
|
||||
|
||||
GrampsDbBase.transaction_commit(self, transaction, msg)
|
||||
DbBase.transaction_commit(self, transaction, msg)
|
||||
|
||||
for (key, data) in transaction.reference_add:
|
||||
self.reference_map.put(str(key), data, txn=self.txn)
|
||||
@ -1524,7 +1524,7 @@ class GrampsBSDDB(GrampsDbGrdb, UpdateCallback):
|
||||
print "Undoing it"
|
||||
if self.UseTXN:
|
||||
self.txn = self.env.txn_begin()
|
||||
status = GrampsDbBase.undo(self, update_history)
|
||||
status = DbBase.undo(self, update_history)
|
||||
if self.UseTXN:
|
||||
if status:
|
||||
self.txn.commit()
|
||||
@ -1537,7 +1537,7 @@ class GrampsBSDDB(GrampsDbGrdb, UpdateCallback):
|
||||
print "Redoing it"
|
||||
if self.UseTXN:
|
||||
self.txn = self.env.txn_begin()
|
||||
status = GrampsDbBase.redo(self, update_history)
|
||||
status = DbBase.redo(self, update_history)
|
||||
if self.UseTXN:
|
||||
if status:
|
||||
self.txn.commit()
|
||||
|
@ -48,7 +48,7 @@ from gen.db.dbconst import (PERSON_KEY, FAMILY_KEY, SOURCE_KEY, EVENT_KEY,
|
||||
from BasicUtils import UpdateCallback
|
||||
import const
|
||||
import libgrampsxml
|
||||
from libmixin import GrampsDbMixin
|
||||
from libmixin import DbMixin
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -83,8 +83,8 @@ EVENT_PERSON_STR = _("%(event_name)s of %(person)s")
|
||||
#-------------------------------------------------------------------------
|
||||
def importData(database, filename, callback=None, cl=0):
|
||||
|
||||
if GrampsDbMixin not in database.__class__.__bases__:
|
||||
database.__class__.__bases__ = (GrampsDbMixin,) + \
|
||||
if DbMixin not in database.__class__.__bases__:
|
||||
database.__class__.__bases__ = (DbMixin,) + \
|
||||
database.__class__.__bases__
|
||||
|
||||
filename = os.path.normpath(filename)
|
||||
|
@ -40,7 +40,7 @@ from bsddb import db
|
||||
from gettext import gettext as _
|
||||
|
||||
import logging
|
||||
LOG = logging.getLogger(".GrampsDb")
|
||||
LOG = logging.getLogger(".Db")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -94,7 +94,7 @@ KEY_TO_CLASS_MAP = {PERSON_KEY: Person.__name__,
|
||||
_SIGBASE = ('person', 'family', 'source', 'event',
|
||||
'media', 'place', 'repository', 'reference', 'note')
|
||||
|
||||
class GrampsDbBookmarks(object):
|
||||
class DbBookmarks(object):
|
||||
def __init__(self, default=[]):
|
||||
self.bookmarks = list(default) # want a copy (not an alias)
|
||||
|
||||
@ -119,7 +119,7 @@ class GrampsDbBookmarks(object):
|
||||
def insert(self, pos, item):
|
||||
self.bookmarks.insert(pos, item)
|
||||
|
||||
class GrampsDbGrdb(Callback):
|
||||
class DbGrdb(Callback):
|
||||
"""
|
||||
GRAMPS database object. This object is a base class for all
|
||||
database interfaces.
|
||||
@ -177,7 +177,7 @@ class GrampsDbGrdb(Callback):
|
||||
|
||||
def __init__(self):
|
||||
"""
|
||||
Create a new GrampsDbBase instance.
|
||||
Create a new DbBase instance.
|
||||
|
||||
A new GrampDbBase class should never be directly created. Only classes
|
||||
derived from this class should be created.
|
||||
@ -256,14 +256,14 @@ class GrampsDbGrdb(Callback):
|
||||
self.default = None
|
||||
self.owner = Researcher()
|
||||
self.name_formats = []
|
||||
self.bookmarks = GrampsDbBookmarks()
|
||||
self.family_bookmarks = GrampsDbBookmarks()
|
||||
self.event_bookmarks = GrampsDbBookmarks()
|
||||
self.place_bookmarks = GrampsDbBookmarks()
|
||||
self.source_bookmarks = GrampsDbBookmarks()
|
||||
self.repo_bookmarks = GrampsDbBookmarks()
|
||||
self.media_bookmarks = GrampsDbBookmarks()
|
||||
self.note_bookmarks = GrampsDbBookmarks()
|
||||
self.bookmarks = DbBookmarks()
|
||||
self.family_bookmarks = DbBookmarks()
|
||||
self.event_bookmarks = DbBookmarks()
|
||||
self.place_bookmarks = DbBookmarks()
|
||||
self.source_bookmarks = DbBookmarks()
|
||||
self.repo_bookmarks = DbBookmarks()
|
||||
self.media_bookmarks = DbBookmarks()
|
||||
self.note_bookmarks = DbBookmarks()
|
||||
self._bm_changes = 0
|
||||
self.path = ""
|
||||
self.surname_list = []
|
||||
@ -2600,7 +2600,7 @@ class Transaction(object):
|
||||
Create a new transaction.
|
||||
|
||||
A Transaction instance should not be created directly, but by the
|
||||
GrampsDbBase class or classes derived from GrampsDbBase. The db
|
||||
DbBase class or classes derived from DbBase. The db
|
||||
parameter is a list-like interface that stores the commit data. This
|
||||
could be a simple list, or a RECNO-style database object.
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
# $Id$
|
||||
|
||||
"""
|
||||
Mixin for GrampsDbDir to enable find_from_handle and check_from_handle methods.
|
||||
Mixin for DbDir to enable find_from_handle and check_from_handle methods.
|
||||
"""
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -34,17 +34,17 @@ from gen.lib import (GenderStats, Person, Family, Event, Place, Source,
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# GrampsDbMixin class
|
||||
# DbMixin class
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
class GrampsDbMixin(object):
|
||||
class DbMixin(object):
|
||||
"""
|
||||
GrampsDbMixin -- a collection of methods to be added to the main
|
||||
DbMixin -- a collection of methods to be added to the main
|
||||
gramps database class for use with import functions. To enable these
|
||||
functions, add the following code to your module:
|
||||
|
||||
if GrampsDbMixin not in database.__class__.__bases__:
|
||||
database.__class__.__bases__ = (GrampsDbMixin,) + \
|
||||
if DbMixin not in database.__class__.__bases__:
|
||||
database.__class__.__bases__ = (DbMixin,) + \
|
||||
database.__class__.__bases__
|
||||
|
||||
where "database" is the object name of your instance of the gramps
|
||||
|
@ -1460,7 +1460,7 @@ class Narrator(object):
|
||||
Initialize the narrator class.
|
||||
|
||||
:param dbase: The database that contains the data to be narrated.
|
||||
:type dbase: :class:`~gen.db.base,GrampsDbBase`
|
||||
:type dbase: :class:`~gen.db.base,DbBase`
|
||||
:param verbose: Specifies whether complete sentences should be used.
|
||||
:type verbose: bool
|
||||
:param use_call_name: Specifies whether a person's call name should be
|
||||
|
@ -113,8 +113,8 @@ def _table_low_level(db,table):
|
||||
return True
|
||||
|
||||
# import gen.db
|
||||
from gen.db import GrampsDBDirAssocCursor
|
||||
table_cursor = GrampsDBDirAssocCursor(table)
|
||||
from gen.db import DbBsddbAssocCursor
|
||||
table_cursor = DbBsddbAssocCursor(table)
|
||||
for handle in dup_handles:
|
||||
print " Duplicates found for handle: %s" % handle
|
||||
try:
|
||||
@ -163,7 +163,7 @@ class Check(Tool.BatchTool):
|
||||
# The low-level repair is bypassing the transaction mechanism.
|
||||
# As such, we run it before starting the transaction.
|
||||
# We only do this for the dbdir backend.
|
||||
if self.db.__class__.__name__ == 'GrampsDBDir':
|
||||
if self.db.__class__.__name__ == 'DbBsddb':
|
||||
low_level(self.db)
|
||||
|
||||
trans = self.db.transaction_begin("", batch=True)
|
||||
|
@ -19,7 +19,7 @@
|
||||
# $Id$
|
||||
#
|
||||
|
||||
""" Implements a GrampsDb interface """
|
||||
""" Implements a Db interface """
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -28,7 +28,7 @@
|
||||
#------------------------------------------------------------------------
|
||||
import web
|
||||
import gen
|
||||
from gen.db import GrampsDbBase
|
||||
from gen.db import DbBase
|
||||
from web.libdjango import DjangoInterface
|
||||
|
||||
# from ReportBase._CommandLineReport import run_report
|
||||
@ -50,7 +50,7 @@ class Cursor(object):
|
||||
def __exit__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
class DjangoDb(GrampsDbBase):
|
||||
class DjangoDb(DbBase):
|
||||
"""
|
||||
A Gramps Database Backend. This replicates the grampsdb functions.
|
||||
"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user