Renamed GrampsCursor to BsddbBaseCursor
svn: r15689
This commit is contained in:
parent
c0944d5df0
commit
791ab064f8
@ -28,11 +28,11 @@ from bsddb import db
|
|||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GrampsCursor class
|
# BsddbBaseCursor class
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
class GrampsCursor(object):
|
class BsddbBaseCursor(object):
|
||||||
"""
|
"""
|
||||||
Provide a basic iterator that allows the user to cycle through
|
Provide a basic iterator that allows the user to cycle through
|
||||||
the elements in a particular map.
|
the elements in a particular map.
|
||||||
|
@ -49,7 +49,7 @@ from gen.lib import (MediaObject, Person, Family, Source, Event, Place,
|
|||||||
Repository, Note, GenderStats, Researcher)
|
Repository, Note, GenderStats, Researcher)
|
||||||
from gen.db.dbconst import *
|
from gen.db.dbconst import *
|
||||||
from gen.utils.callback import Callback
|
from gen.utils.callback import Callback
|
||||||
from gen.db import (GrampsCursor, DbReadBase)
|
from gen.db import (BsddbBaseCursor, DbReadBase)
|
||||||
from Utils import create_id
|
from Utils import create_id
|
||||||
import Errors
|
import Errors
|
||||||
|
|
||||||
@ -97,10 +97,10 @@ class DbBookmarks(object):
|
|||||||
# GrampsDBReadCursor
|
# GrampsDBReadCursor
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class DbReadCursor(GrampsCursor):
|
class DbReadCursor(BsddbBaseCursor):
|
||||||
|
|
||||||
def __init__(self, source, txn=None, **kwargs):
|
def __init__(self, source, txn=None, **kwargs):
|
||||||
GrampsCursor.__init__(self, txn=txn, **kwargs)
|
BsddbBaseCursor.__init__(self, txn=txn, **kwargs)
|
||||||
self.cursor = source.db.cursor(txn)
|
self.cursor = source.db.cursor(txn)
|
||||||
self.source = source
|
self.source = source
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ from sys import maxint
|
|||||||
from gen.lib import (GenderStats, Person, Family, Event, Place, Source,
|
from gen.lib import (GenderStats, Person, Family, Event, Place, Source,
|
||||||
MediaObject, Repository, Note)
|
MediaObject, Repository, Note)
|
||||||
from gen.db import (DbBsddbRead, DbWriteBase, BSDDBTxn,
|
from gen.db import (DbBsddbRead, DbWriteBase, BSDDBTxn,
|
||||||
DbTxn, GrampsCursor,DbVersionError,
|
DbTxn, BsddbBaseCursor, DbVersionError,
|
||||||
DbUpgradeRequiredError,
|
DbUpgradeRequiredError,
|
||||||
DbUndoBSDDB as DbUndo)
|
DbUndoBSDDB as DbUndo)
|
||||||
from gen.db.dbconst import *
|
from gen.db.dbconst import *
|
||||||
@ -140,13 +140,13 @@ def find_referenced_handle(key, data):
|
|||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GrampsWriteCursor
|
# BsddbWriteCursor
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class GrampsWriteCursor(GrampsCursor):
|
class BsddbWriteCursor(BsddbBaseCursor):
|
||||||
|
|
||||||
def __init__(self, source, txn=None, **kwargs):
|
def __init__(self, source, txn=None, **kwargs):
|
||||||
GrampsCursor.__init__(self, txn=txn, **kwargs)
|
BsddbBaseCursor.__init__(self, txn=txn, **kwargs)
|
||||||
self.cursor = source.db.cursor(txn)
|
self.cursor = source.db.cursor(txn)
|
||||||
self.source = source
|
self.source = source
|
||||||
|
|
||||||
@ -155,10 +155,10 @@ class GrampsWriteCursor(GrampsCursor):
|
|||||||
# DbBsddbAssocCursor
|
# DbBsddbAssocCursor
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class DbBsddbAssocCursor(GrampsCursor):
|
class DbBsddbAssocCursor(BsddbBaseCursor):
|
||||||
|
|
||||||
def __init__(self, source, txn=None, **kwargs):
|
def __init__(self, source, txn=None, **kwargs):
|
||||||
GrampsCursor.__init__(self, txn=txn, **kwargs)
|
BsddbBaseCursor.__init__(self, txn=txn, **kwargs)
|
||||||
self.cursor = source.cursor(txn)
|
self.cursor = source.cursor(txn)
|
||||||
self.source = source
|
self.source = source
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
""" Helper function to return a cursor over a table """
|
""" Helper function to return a cursor over a table """
|
||||||
if update and not txn:
|
if update and not txn:
|
||||||
txn = self.env.txn_begin(self.txn)
|
txn = self.env.txn_begin(self.txn)
|
||||||
return GrampsWriteCursor(table, txn=txn or self.txn,
|
return BsddbWriteCursor(table, txn=txn or self.txn,
|
||||||
update=update, commit=commit)
|
update=update, commit=commit)
|
||||||
|
|
||||||
# cursors for lookups in the reference_map for back reference
|
# cursors for lookups in the reference_map for back reference
|
||||||
|
@ -51,7 +51,7 @@ from gen.lib import (GenderStats, Source, Person, Family, Event, Place,
|
|||||||
from gen.db.write import (KEY_TO_CLASS_MAP, CLASS_TO_KEY_MAP)
|
from gen.db.write import (KEY_TO_CLASS_MAP, CLASS_TO_KEY_MAP)
|
||||||
from libgrdb import DbGrdb
|
from libgrdb import DbGrdb
|
||||||
from gen.db.txn import DbTxn as Transaction
|
from gen.db.txn import DbTxn as Transaction
|
||||||
from gen.db.cursor import GrampsCursor
|
from gen.db.cursor import BsddbBaseCursor
|
||||||
from gen.db.dbconst import *
|
from gen.db.dbconst import *
|
||||||
from gen.db.exceptions import DbVersionError
|
from gen.db.exceptions import DbVersionError
|
||||||
import const
|
import const
|
||||||
@ -105,7 +105,7 @@ def find_referenced_handle(key, data):
|
|||||||
"""
|
"""
|
||||||
return str((data)[1][1])
|
return str((data)[1][1])
|
||||||
|
|
||||||
class GrampsBSDDBCursor(GrampsCursor):
|
class GrampsBSDDBCursor(BsddbBaseCursor):
|
||||||
"""
|
"""
|
||||||
Cursor to loop through a BSDDB table
|
Cursor to loop through a BSDDB table
|
||||||
"""
|
"""
|
||||||
@ -113,7 +113,7 @@ class GrampsBSDDBCursor(GrampsCursor):
|
|||||||
self.cursor = source.db.cursor(txn)
|
self.cursor = source.db.cursor(txn)
|
||||||
self.source = source
|
self.source = source
|
||||||
|
|
||||||
class GrampsBSDDBAssocCursor(GrampsCursor):
|
class GrampsBSDDBAssocCursor(BsddbBaseCursor):
|
||||||
|
|
||||||
def __init__(self, source, txn=None):
|
def __init__(self, source, txn=None):
|
||||||
self.cursor = source.cursor(txn)
|
self.cursor = source.cursor(txn)
|
||||||
|
Loading…
Reference in New Issue
Block a user