* src/GrampsDb/_GrampsDbBase.py (find_next_*_gramps_id): check

whether the key exists, do not read.
* src/GrampsDb/_GrampsBSDDB.py (find_next_*_gramps_id): Remove
methods, as there's no need to override ones the DbBase now.


svn: r5860
This commit is contained in:
Alex Roitman 2006-01-31 20:39:25 +00:00
parent 3bb985186d
commit b13d42d960
3 changed files with 13 additions and 91 deletions

View File

@ -1,3 +1,9 @@
2006-01-31 Alex Roitman <shura@gramps-project.org>
* src/GrampsDb/_GrampsDbBase.py (find_next_*_gramps_id): check
whether the key exists, do not read.
* src/GrampsDb/_GrampsBSDDB.py (find_next_*_gramps_id): Remove
methods, as there's no need to override ones the DbBase now.
2006-01-31 Don Allingham <don@gramps-project.org> 2006-01-31 Don Allingham <don@gramps-project.org>
* src/EditPerson.py: clean up building notebook pages * src/EditPerson.py: clean up building notebook pages
* src/DisplayTabs.py: support for drag-n-drop * src/DisplayTabs.py: support for drag-n-drop

View File

@ -964,90 +964,6 @@ class GrampsBSDDB(GrampsDbBase):
add_func(obj,transaction) add_func(obj,transaction)
return obj return obj
def find_next_person_gramps_id(self):
"""
Returns the next available GRAMPS' ID for a Person object based
off the person ID prefix.
"""
index = self.iprefix % self.pmap_index
while self.id_trans.get(str(index),txn=self.txn):
self.pmap_index += 1
index = self.iprefix % self.pmap_index
self.pmap_index += 1
return index
def find_next_place_gramps_id(self):
"""
Returns the next available GRAMPS' ID for a Place object based
off the person ID prefix.
"""
index = self.pprefix % self.lmap_index
while self.pid_trans.get(str(index),txn=self.txn):
self.lmap_index += 1
index = self.pprefix % self.lmap_index
self.lmap_index += 1
return index
def find_next_event_gramps_id(self):
"""
Returns the next available GRAMPS' ID for a Event object based
off the person ID prefix.
"""
index = self.eprefix % self.emap_index
while self.eid_trans.get(str(index),txn=self.txn):
self.emap_index += 1
index = self.eprefix % self.emap_index
self.emap_index += 1
return index
def find_next_object_gramps_id(self):
"""
Returns the next available GRAMPS' ID for a MediaObject object based
off the person ID prefix.
"""
index = self.oprefix % self.omap_index
while self.oid_trans.get(str(index),txn=self.txn):
self.omap_index += 1
index = self.oprefix % self.omap_index
self.omap_index += 1
return index
def find_next_source_gramps_id(self):
"""
Returns the next available GRAMPS' ID for a Source object based
off the person ID prefix.
"""
index = self.sprefix % self.smap_index
while self.sid_trans.get(str(index),txn=self.txn):
self.smap_index += 1
index = self.sprefix % self.smap_index
self.smap_index += 1
return index
def find_next_family_gramps_id(self):
"""
Returns the next available GRAMPS' ID for a Family object based
off the person ID prefix.
"""
index = self.fprefix % self.fmap_index
while self.fid_trans.get(str(index),txn=self.txn):
self.fmap_index += 1
index = self.fprefix % self.fmap_index
self.fmap_index += 1
return index
def find_next_repository_gramps_id(self):
"""
Returns the next available GRAMPS' ID for a Respository object based
off the repository ID prefix.
"""
index = self.rprefix % self.rmap_index
while self.rid_trans.get(str(index),txn=self.txn):
self.rmap_index += 1
index = self.rprefix % self.rmap_index
self.rmap_index += 1
return index
def transaction_begin(self,msg="",batch=False): def transaction_begin(self,msg="",batch=False):
""" """
Creates a new Transaction tied to the current UNDO database. The Creates a new Transaction tied to the current UNDO database. The

View File

@ -485,7 +485,7 @@ class GrampsDbBase(GrampsDBCallback):
off the person ID prefix. off the person ID prefix.
""" """
index = self.iprefix % self.pmap_index index = self.iprefix % self.pmap_index
while self.id_trans.get(str(index)): while self.id_trans.has_key(str(index)):
self.pmap_index += 1 self.pmap_index += 1
index = self.iprefix % self.pmap_index index = self.iprefix % self.pmap_index
self.pmap_index += 1 self.pmap_index += 1
@ -497,7 +497,7 @@ class GrampsDbBase(GrampsDBCallback):
off the person ID prefix. off the person ID prefix.
""" """
index = self.pprefix % self.lmap_index index = self.pprefix % self.lmap_index
while self.pid_trans.get(str(index)): while self.pid_trans.has_key(str(index)):
self.lmap_index += 1 self.lmap_index += 1
index = self.pprefix % self.lmap_index index = self.pprefix % self.lmap_index
self.lmap_index += 1 self.lmap_index += 1
@ -509,7 +509,7 @@ class GrampsDbBase(GrampsDBCallback):
off the person ID prefix. off the person ID prefix.
""" """
index = self.eprefix % self.emap_index index = self.eprefix % self.emap_index
while self.eid_trans.get(str(index)): while self.eid_trans.has_key(str(index)):
self.emap_index += 1 self.emap_index += 1
index = self.eprefix % self.emap_index index = self.eprefix % self.emap_index
self.emap_index += 1 self.emap_index += 1
@ -521,7 +521,7 @@ class GrampsDbBase(GrampsDBCallback):
off the person ID prefix. off the person ID prefix.
""" """
index = self.oprefix % self.omap_index index = self.oprefix % self.omap_index
while self.oid_trans.get(str(index)): while self.oid_trans.has_key(str(index)):
self.omap_index += 1 self.omap_index += 1
index = self.oprefix % self.omap_index index = self.oprefix % self.omap_index
self.omap_index += 1 self.omap_index += 1
@ -533,7 +533,7 @@ class GrampsDbBase(GrampsDBCallback):
off the person ID prefix. off the person ID prefix.
""" """
index = self.sprefix % self.smap_index index = self.sprefix % self.smap_index
while self.sid_trans.get(str(index)): while self.sid_trans.has_key(str(index)):
self.smap_index += 1 self.smap_index += 1
index = self.sprefix % self.smap_index index = self.sprefix % self.smap_index
self.smap_index += 1 self.smap_index += 1
@ -545,7 +545,7 @@ class GrampsDbBase(GrampsDBCallback):
off the person ID prefix. off the person ID prefix.
""" """
index = self.fprefix % self.fmap_index index = self.fprefix % self.fmap_index
while self.fid_trans.get(str(index)): while self.fid_trans.has_key(str(index)):
self.fmap_index += 1 self.fmap_index += 1
index = self.fprefix % self.fmap_index index = self.fprefix % self.fmap_index
self.fmap_index += 1 self.fmap_index += 1
@ -557,7 +557,7 @@ class GrampsDbBase(GrampsDBCallback):
off the repository ID prefix. off the repository ID prefix.
""" """
index = self.rprefix % self.rmap_index index = self.rprefix % self.rmap_index
while self.rid_trans.get(str(index)): while self.rid_trans.has_key(str(index)):
self.rmap_index += 1 self.rmap_index += 1
index = self.rprefix % self.rmap_index index = self.rprefix % self.rmap_index
self.rmap_index += 1 self.rmap_index += 1