Refinements on database hierarchy
svn: r13907
This commit is contained in:
parent
ab2f9b9d19
commit
06d0291ff4
@ -46,8 +46,6 @@ class DbReadBase(object):
|
|||||||
derived from this class should be created.
|
derived from this class should be created.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
super(DbReadBase, self).__init__()
|
|
||||||
|
|
||||||
def all_handles(self, table):
|
def all_handles(self, table):
|
||||||
"""
|
"""
|
||||||
Return all handles from the specified table as a list
|
Return all handles from the specified table as a list
|
||||||
@ -1172,7 +1170,7 @@ class DbReadBase(object):
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
class DbWriteBase(DbReadBase):
|
class DbWriteBase(object):
|
||||||
"""
|
"""
|
||||||
GRAMPS database object. This object is a base class for all
|
GRAMPS database object. This object is a base class for all
|
||||||
database interfaces. All methods raise NotImplementedError
|
database interfaces. All methods raise NotImplementedError
|
||||||
@ -1187,8 +1185,6 @@ class DbWriteBase(DbReadBase):
|
|||||||
derived from this class should be created.
|
derived from this class should be created.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
super(DbWriteBase, self).__init__()
|
|
||||||
|
|
||||||
def add_event(self, event, transaction, set_gid=True):
|
def add_event(self, event, transaction, set_gid=True):
|
||||||
"""
|
"""
|
||||||
Add an Event to the database, assigning internal IDs if they have
|
Add an Event to the database, assigning internal IDs if they have
|
||||||
|
@ -180,7 +180,7 @@ class DbBsddbRead(DbReadBase, Callback):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
DbReadBase.__init__(self)
|
DbReadBase.__init__(self)
|
||||||
#Callback.__init__(self)
|
Callback.__init__(self)
|
||||||
|
|
||||||
self.set_person_id_prefix('I%04d')
|
self.set_person_id_prefix('I%04d')
|
||||||
self.set_object_id_prefix('O%04d')
|
self.set_object_id_prefix('O%04d')
|
||||||
|
@ -167,8 +167,7 @@ class DbBsddbAssocCursor(GrampsCursor):
|
|||||||
# DbBsddb
|
# DbBsddb
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class DbBsddb(DbBsddbRead, DbWriteBase,
|
class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||||
Callback, UpdateCallback):
|
|
||||||
"""
|
"""
|
||||||
GRAMPS database write access object.
|
GRAMPS database write access object.
|
||||||
"""
|
"""
|
||||||
@ -200,7 +199,8 @@ class DbBsddb(DbBsddbRead, DbWriteBase,
|
|||||||
|
|
||||||
self.txn = None
|
self.txn = None
|
||||||
DbBsddbRead.__init__(self)
|
DbBsddbRead.__init__(self)
|
||||||
Callback.__init__(self)
|
DbWriteBase.__init__(self)
|
||||||
|
#UpdateCallback.__init__(self)
|
||||||
self.secondary_connected = False
|
self.secondary_connected = False
|
||||||
self.has_changed = False
|
self.has_changed = False
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import web
|
import web
|
||||||
import gen
|
import gen
|
||||||
from gen.db import DbBase
|
from gen.db import DbReadBase, DbWriteBase
|
||||||
from web.libdjango import DjangoInterface
|
from web.libdjango import DjangoInterface
|
||||||
|
|
||||||
# from ReportBase._CommandLineReport import run_report
|
# from ReportBase._CommandLineReport import run_report
|
||||||
@ -50,13 +50,14 @@ class Cursor(object):
|
|||||||
def __exit__(self, *args, **kwargs):
|
def __exit__(self, *args, **kwargs):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class DjangoDb(DbBase):
|
class DjangoDb(DbReadBase, DbWriteBase):
|
||||||
"""
|
"""
|
||||||
A Gramps Database Backend. This replicates the grampsdb functions.
|
A Gramps Database Backend. This replicates the grampsdb functions.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(DjangoDb, self).__init__()
|
DbReadBase.__init__(self)
|
||||||
|
DbWriteBase.__init__(self)
|
||||||
self.dji = DjangoInterface()
|
self.dji = DjangoInterface()
|
||||||
self.readonly = False
|
self.readonly = False
|
||||||
self.db_is_open = True
|
self.db_is_open = True
|
||||||
|
Loading…
Reference in New Issue
Block a user