From 04de8dc8d4d08aed484e1fc81e1edd903e1635cd Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Tue, 31 Jan 2006 20:39:25 +0000 Subject: [PATCH] * 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 --- ChangeLog | 6 +++ src/GrampsDb/_GrampsBSDDB.py | 84 ----------------------------------- src/GrampsDb/_GrampsDbBase.py | 14 +++--- 3 files changed, 13 insertions(+), 91 deletions(-) diff --git a/ChangeLog b/ChangeLog index 380ab15e4..07ac9d9fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-01-31 Alex Roitman + * 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 * src/EditPerson.py: clean up building notebook pages * src/DisplayTabs.py: support for drag-n-drop diff --git a/src/GrampsDb/_GrampsBSDDB.py b/src/GrampsDb/_GrampsBSDDB.py index 2c7a27be4..917adb4fb 100644 --- a/src/GrampsDb/_GrampsBSDDB.py +++ b/src/GrampsDb/_GrampsBSDDB.py @@ -964,90 +964,6 @@ class GrampsBSDDB(GrampsDbBase): add_func(obj,transaction) 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): """ Creates a new Transaction tied to the current UNDO database. The diff --git a/src/GrampsDb/_GrampsDbBase.py b/src/GrampsDb/_GrampsDbBase.py index 72b2b86e7..f864d66b5 100644 --- a/src/GrampsDb/_GrampsDbBase.py +++ b/src/GrampsDb/_GrampsDbBase.py @@ -485,7 +485,7 @@ class GrampsDbBase(GrampsDBCallback): off the person ID prefix. """ 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 index = self.iprefix % self.pmap_index self.pmap_index += 1 @@ -497,7 +497,7 @@ class GrampsDbBase(GrampsDBCallback): off the person ID prefix. """ 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 index = self.pprefix % self.lmap_index self.lmap_index += 1 @@ -509,7 +509,7 @@ class GrampsDbBase(GrampsDBCallback): off the person ID prefix. """ 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 index = self.eprefix % self.emap_index self.emap_index += 1 @@ -521,7 +521,7 @@ class GrampsDbBase(GrampsDBCallback): off the person ID prefix. """ 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 index = self.oprefix % self.omap_index self.omap_index += 1 @@ -533,7 +533,7 @@ class GrampsDbBase(GrampsDBCallback): off the person ID prefix. """ 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 index = self.sprefix % self.smap_index self.smap_index += 1 @@ -545,7 +545,7 @@ class GrampsDbBase(GrampsDBCallback): off the person ID prefix. """ 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 index = self.fprefix % self.fmap_index self.fmap_index += 1 @@ -557,7 +557,7 @@ class GrampsDbBase(GrampsDBCallback): off the repository ID prefix. """ 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 index = self.rprefix % self.rmap_index self.rmap_index += 1