diff --git a/gramps/gen/db/generic.py b/gramps/gen/db/generic.py index fb60ad566..f3e2ee1c1 100644 --- a/gramps/gen/db/generic.py +++ b/gramps/gen/db/generic.py @@ -1352,7 +1352,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback): def add_person(self, person, trans, set_gid=True): if not person.handle: person.handle = create_id() - if (not person.gramps_id) or set_gid: + if (not person.gramps_id) and set_gid: person.gramps_id = self.find_next_person_gramps_id() self.commit_person(person, trans) return person.handle @@ -1360,7 +1360,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback): def add_family(self, family, trans, set_gid=True): if not family.handle: family.handle = create_id() - if (not family.gramps_id) or set_gid: + if (not family.gramps_id) and set_gid: family.gramps_id = self.find_next_family_gramps_id() self.commit_family(family, trans) return family.handle @@ -1368,7 +1368,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback): def add_citation(self, citation, trans, set_gid=True): if not citation.handle: citation.handle = create_id() - if (not citation.gramps_id) or set_gid: + if (not citation.gramps_id) and set_gid: citation.gramps_id = self.find_next_citation_gramps_id() self.commit_citation(citation, trans) return citation.handle @@ -1376,7 +1376,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback): def add_source(self, source, trans, set_gid=True): if not source.handle: source.handle = create_id() - if (not source.gramps_id) or set_gid: + if (not source.gramps_id) and set_gid: source.gramps_id = self.find_next_source_gramps_id() self.commit_source(source, trans) return source.handle @@ -1384,7 +1384,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback): def add_repository(self, repository, trans, set_gid=True): if not repository.handle: repository.handle = create_id() - if (not repository.gramps_id) or set_gid: + if (not repository.gramps_id) and set_gid: repository.gramps_id = self.find_next_repository_gramps_id() self.commit_repository(repository, trans) return repository.handle @@ -1392,7 +1392,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback): def add_note(self, note, trans, set_gid=True): if not note.handle: note.handle = create_id() - if (not note.gramps_id) or set_gid: + if (not note.gramps_id) and set_gid: note.gramps_id = self.find_next_note_gramps_id() self.commit_note(note, trans) return note.handle @@ -1400,7 +1400,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback): def add_place(self, place, trans, set_gid=True): if not place.handle: place.handle = create_id() - if (not place.gramps_id) or set_gid: + if (not place.gramps_id) and set_gid: place.gramps_id = self.find_next_place_gramps_id() self.commit_place(place, trans) return place.handle @@ -1408,7 +1408,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback): def add_event(self, event, trans, set_gid=True): if not event.handle: event.handle = create_id() - if (not event.gramps_id) or set_gid: + if (not event.gramps_id) and set_gid: event.gramps_id = self.find_next_event_gramps_id() self.commit_event(event, trans) return event.handle @@ -1428,7 +1428,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback): """ if not obj.handle: obj.handle = create_id() - if (not obj.gramps_id) or set_gid: + if (not obj.gramps_id) and set_gid: obj.gramps_id = self.find_next_object_gramps_id() self.commit_media_object(obj, transaction) return obj.handle