Merge pull request #265 from prculley/bug9755_42
bug 9755, fix duplicated Gramps IDs on Gedcom import (gramps42)
This commit is contained in:
commit
703703cc75
@ -5,6 +5,7 @@
|
|||||||
# Copyright (C) 2009-2010 Gary Burton
|
# Copyright (C) 2009-2010 Gary Burton
|
||||||
# Copyright (C) 2010 Nick Hall
|
# Copyright (C) 2010 Nick Hall
|
||||||
# Copyright (C) 2011 Tim G L Lyons
|
# Copyright (C) 2011 Tim G L Lyons
|
||||||
|
# Copyright (C) 2016 Paul R. Culley
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -2959,12 +2960,11 @@ class GedcomParser(UpdateCallback):
|
|||||||
|
|
||||||
def __find_or_create_note(self, gramps_id):
|
def __find_or_create_note(self, gramps_id):
|
||||||
"""
|
"""
|
||||||
Finds or creates a repository based on the GRAMPS ID. If the ID is
|
Finds or creates a note based on the GRAMPS ID. If the ID is
|
||||||
already used (is in the db), we return the item in the db. Otherwise,
|
already used (is in the db), we return the item in the db. Otherwise,
|
||||||
we create a new repository, assign the handle and GRAMPS ID.
|
we create a new note, assign the handle and GRAMPS ID.
|
||||||
|
If no GRAMPS ID is passed in, we not only make a Note with GID, we
|
||||||
Some GEDCOM "flavors" destroy the specification, and declare the
|
commit it.
|
||||||
repository inline instead of in a object.
|
|
||||||
"""
|
"""
|
||||||
note = Note()
|
note = Note()
|
||||||
if not gramps_id:
|
if not gramps_id:
|
||||||
@ -3523,7 +3523,7 @@ class GedcomParser(UpdateCallback):
|
|||||||
if self.use_def_src:
|
if self.use_def_src:
|
||||||
repo.set_name(submitter_name)
|
repo.set_name(submitter_name)
|
||||||
repo.set_handle(create_id())
|
repo.set_handle(create_id())
|
||||||
repo.set_gramps_id(self.dbase.find_next_repository_gramps_id())
|
repo.set_gramps_id(self.rid_map[""])
|
||||||
|
|
||||||
addr = Address()
|
addr = Address()
|
||||||
addr.set_street(state.res.get_address())
|
addr.set_street(state.res.get_address())
|
||||||
@ -3875,7 +3875,6 @@ class GedcomParser(UpdateCallback):
|
|||||||
"""
|
"""
|
||||||
self.__obje(line, state, state.person)
|
self.__obje(line, state, state.person)
|
||||||
|
|
||||||
|
|
||||||
def __person_photo(self, line, state):
|
def __person_photo(self, line, state):
|
||||||
"""
|
"""
|
||||||
This handles the FTM _PHOTO feature, which identifies an OBJE to use
|
This handles the FTM _PHOTO feature, which identifies an OBJE to use
|
||||||
@ -5225,7 +5224,6 @@ class GedcomParser(UpdateCallback):
|
|||||||
"""
|
"""
|
||||||
self.__obje(line, state, state.family)
|
self.__obje(line, state, state.family)
|
||||||
|
|
||||||
|
|
||||||
def __family_comm(self, line, state):
|
def __family_comm(self, line, state):
|
||||||
"""
|
"""
|
||||||
@param line: The current line in GedLine format
|
@param line: The current line in GedLine format
|
||||||
@ -5561,7 +5559,6 @@ class GedcomParser(UpdateCallback):
|
|||||||
"""
|
"""
|
||||||
self.__obje(line, state, state.event)
|
self.__obje(line, state, state.event)
|
||||||
|
|
||||||
|
|
||||||
def __event_type(self, line, state):
|
def __event_type(self, line, state):
|
||||||
"""
|
"""
|
||||||
Parses the TYPE line for an event.
|
Parses the TYPE line for an event.
|
||||||
@ -5681,7 +5678,6 @@ class GedcomParser(UpdateCallback):
|
|||||||
"""
|
"""
|
||||||
self.__obje(line, state, state.place)
|
self.__obje(line, state, state.place)
|
||||||
|
|
||||||
|
|
||||||
def __event_place_sour(self, line, state):
|
def __event_place_sour(self, line, state):
|
||||||
"""
|
"""
|
||||||
@param line: The current line in GedLine format
|
@param line: The current line in GedLine format
|
||||||
@ -6319,7 +6315,7 @@ class GedcomParser(UpdateCallback):
|
|||||||
def __source_text(self, line, state):
|
def __source_text(self, line, state):
|
||||||
note = Note()
|
note = Note()
|
||||||
note.set(line.data)
|
note.set(line.data)
|
||||||
gramps_id = self.dbase.find_next_note_gramps_id()
|
gramps_id = self.nid_map[""]
|
||||||
note.set_gramps_id(gramps_id)
|
note.set_gramps_id(gramps_id)
|
||||||
note.set_type(NoteType.SOURCE_TEXT)
|
note.set_type(NoteType.SOURCE_TEXT)
|
||||||
self.dbase.add_note(note, self.trans)
|
self.dbase.add_note(note, self.trans)
|
||||||
@ -6329,7 +6325,7 @@ class GedcomParser(UpdateCallback):
|
|||||||
def __citation_data_text(self, line, state):
|
def __citation_data_text(self, line, state):
|
||||||
note = Note()
|
note = Note()
|
||||||
note.set(line.data)
|
note.set(line.data)
|
||||||
gramps_id = self.dbase.find_next_note_gramps_id()
|
gramps_id = self.nid_map[""]
|
||||||
note.set_gramps_id(gramps_id)
|
note.set_gramps_id(gramps_id)
|
||||||
note.set_type(NoteType.SOURCE_TEXT)
|
note.set_type(NoteType.SOURCE_TEXT)
|
||||||
self.dbase.add_note(note, self.trans)
|
self.dbase.add_note(note, self.trans)
|
||||||
@ -6346,7 +6342,7 @@ class GedcomParser(UpdateCallback):
|
|||||||
line.data,
|
line.data,
|
||||||
[(0, len(line.data))])
|
[(0, len(line.data))])
|
||||||
note.set_styledtext(StyledText(line.data, [tags]))
|
note.set_styledtext(StyledText(line.data, [tags]))
|
||||||
gramps_id = self.dbase.find_next_note_gramps_id()
|
gramps_id = self.nid_map[""]
|
||||||
note.set_gramps_id(gramps_id)
|
note.set_gramps_id(gramps_id)
|
||||||
note.set_type(NoteType.CITATION)
|
note.set_type(NoteType.CITATION)
|
||||||
self.dbase.add_note(note, self.trans)
|
self.dbase.add_note(note, self.trans)
|
||||||
@ -6359,7 +6355,7 @@ class GedcomParser(UpdateCallback):
|
|||||||
"""
|
"""
|
||||||
note = Note()
|
note = Note()
|
||||||
note.set(line.data)
|
note.set(line.data)
|
||||||
gramps_id = self.dbase.find_next_note_gramps_id()
|
gramps_id = self.nid_map[""]
|
||||||
note.set_gramps_id(gramps_id)
|
note.set_gramps_id(gramps_id)
|
||||||
note.set_type(_("Citation Justification"))
|
note.set_type(_("Citation Justification"))
|
||||||
self.dbase.add_note(note, self.trans)
|
self.dbase.add_note(note, self.trans)
|
||||||
@ -6379,7 +6375,6 @@ class GedcomParser(UpdateCallback):
|
|||||||
"""
|
"""
|
||||||
self.__obje(line, state, state.citation)
|
self.__obje(line, state, state.citation)
|
||||||
|
|
||||||
|
|
||||||
def __citation_refn(self, line, state):
|
def __citation_refn(self, line, state):
|
||||||
"""
|
"""
|
||||||
Parses the REFN line of an SOUR instance tag
|
Parses the REFN line of an SOUR instance tag
|
||||||
@ -6519,7 +6514,6 @@ class GedcomParser(UpdateCallback):
|
|||||||
"""
|
"""
|
||||||
self.__obje(line, state, state.source)
|
self.__obje(line, state, state.source)
|
||||||
|
|
||||||
|
|
||||||
def __source_chan(self, line, state):
|
def __source_chan(self, line, state):
|
||||||
"""
|
"""
|
||||||
@param line: The current line in GedLine format
|
@param line: The current line in GedLine format
|
||||||
@ -6567,7 +6561,7 @@ class GedcomParser(UpdateCallback):
|
|||||||
# This format has no repository name. See http://west-
|
# This format has no repository name. See http://west-
|
||||||
# penwith.org.uk/misc/ftmged.htm which points out this is
|
# penwith.org.uk/misc/ftmged.htm which points out this is
|
||||||
# incorrect
|
# incorrect
|
||||||
gid = self.dbase.find_next_repository_gramps_id()
|
gid = self.rid_map[""]
|
||||||
repo = self.__find_or_create_repository(gid)
|
repo = self.__find_or_create_repository(gid)
|
||||||
self.dbase.commit_repository(repo, self.trans)
|
self.dbase.commit_repository(repo, self.trans)
|
||||||
else:
|
else:
|
||||||
@ -6581,7 +6575,7 @@ class GedcomParser(UpdateCallback):
|
|||||||
# non-standard GEDCOM.
|
# non-standard GEDCOM.
|
||||||
gid = self.repo2id.get(line.data)
|
gid = self.repo2id.get(line.data)
|
||||||
if gid is None:
|
if gid is None:
|
||||||
gid = self.dbase.find_next_repository_gramps_id()
|
gid = self.rid_map[""]
|
||||||
repo = self.__find_or_create_repository(gid)
|
repo = self.__find_or_create_repository(gid)
|
||||||
self.repo2id[line.data] = repo.get_gramps_id()
|
self.repo2id[line.data] = repo.get_gramps_id()
|
||||||
repo.set_name(line.data)
|
repo.set_name(line.data)
|
||||||
@ -7759,7 +7753,7 @@ class GedcomParser(UpdateCallback):
|
|||||||
handle = self.inline_srcs.get(title, create_id())
|
handle = self.inline_srcs.get(title, create_id())
|
||||||
src = Source()
|
src = Source()
|
||||||
src.handle = handle
|
src.handle = handle
|
||||||
src.gramps_id = self.dbase.find_next_source_gramps_id()
|
src.gramps_id = self.sid_map[""]
|
||||||
self.inline_srcs[title] = handle
|
self.inline_srcs[title] = handle
|
||||||
else:
|
else:
|
||||||
src = self.__find_or_create_source(self.sid_map[line.data])
|
src = self.__find_or_create_source(self.sid_map[line.data])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user