Fixed the place and family references on import

svn: r1501
This commit is contained in:
Don Allingham
2003-05-07 03:36:28 +00:00
parent 37ef7aebcc
commit 51eb45c59a
2 changed files with 44 additions and 12 deletions

View File

@@ -2383,7 +2383,7 @@ class GrampsDB(Persistent):
return index
def removeObject(self,id):
del self.placeMap[id]
del self.objectMap[id]
def removePlace(self,id):
del self.placeMap[id]
@@ -2392,6 +2392,7 @@ class GrampsDB(Persistent):
def addPlaceAs(self,place):
self.placeMap[place.getId()] = place
self.placeTable[place.getId()] = place.getDisplayInfo()
return place.getId()
def findPlace(self,idVal,map):
"""finds a Place in the database using the idVal and map
@@ -2419,7 +2420,6 @@ class GrampsDB(Persistent):
idVal - external ID number
map - map build by findPlace of external to gramp's IDs"""
idVal = str(idVal)
if map.has_key(idVal):
place = self.placeMap[map[idVal]]
else:
@@ -2518,6 +2518,27 @@ class GrampsDB(Persistent):
map[idVal] = family.getId()
return family
def findFamilyNoConflict(self,idVal,map):
"""finds a Family in the database using the idVal and map
variables to translate between the external ID and gramps'
internal ID. If no such Family exists, a new Family instance
is created.
idVal - external ID number
map - map build by findFamily of external to gramp's IDs"""
if map.has_key(idVal):
family = self.familyMap[map[idVal]]
else:
family = self.familyMap.get(idVal)
if not family:
family = Family()
family.id = idVal
self.familyMap[idVal] = family
self.fmapIndex = self.fmapIndex + 1
map[idVal] = family.getId()
return family
def findFamilyNoMap(self,val):
"""finds a Family in the database from the passed gramps' ID.
If no such Family exists, a new Family is added to the database."""