* src/GrampsParser.py (start_childof): Call add_parent_family_id()

with three arguments, instead of a tuple.
* src/ReadXML.py: Comment out renaming lost media objects for now.
* src/RelLib.py (find_place_no_conflicts,
find_family_no_conflicts): Use str(idVal).


svn: r2926
This commit is contained in:
Alex Roitman 2004-02-28 19:34:29 +00:00
parent 89f2a1cfc7
commit 01fc337256
4 changed files with 58 additions and 51 deletions

View File

@ -1,3 +1,10 @@
2004-02-28 Alex Roitman <shura@alex.neuro.umn.edu>
* src/GrampsParser.py (start_childof): Call add_parent_family_id()
with three arguments, instead of a tuple.
* src/ReadXML.py: Comment out renaming lost media objects for now.
* src/RelLib.py (find_place_no_conflicts,
find_family_no_conflicts): Use str(idVal).
2004-02-28 Don Allingham <dallingham@users.sourceforge.net> 2004-02-28 Don Allingham <dallingham@users.sourceforge.net>
* src/gramps_main.py: switch to DB as default, remove save option * src/gramps_main.py: switch to DB as default, remove save option
* src/RelLib.py: setup DB environment better * src/RelLib.py: setup DB environment better

View File

@ -946,7 +946,7 @@ class GrampsImportParser(GrampsParser):
frel = attrs["frel"] frel = attrs["frel"]
else: else:
frel = "Birth" frel = "Birth"
self.person.add_parent_family_id((family.get_id(),mrel,frel)) self.person.add_parent_family_id(family.get_id(),mrel,frel)
def start_parentin(self,attrs): def start_parentin(self,attrs):
self.person.add_family_id(attrs["ref"]) self.person.add_family_id(attrs["ref"])

View File

@ -203,44 +203,44 @@ def importData(database, filename, callback,cl=0):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# Rename media files if they were conflicting with existing ones # # Rename media files if they were conflicting with existing ones
ObjectMap = database.get_object_map() # ObjectMap = database.get_object_map()
newpath = database.get_save_path() # newpath = database.get_save_path()
for OldMediaID in parser.MediaFileMap.keys(): # for OldMediaID in parser.MediaFileMap.keys():
NewMediaID = parser.MediaFileMap[OldMediaID] # NewMediaID = parser.MediaFileMap[OldMediaID]
oldfile = ObjectMap[NewMediaID].get_path() # oldfile = ObjectMap[NewMediaID].get_path()
(junk,oldext) = os.path.splitext(os.path.basename(oldfile)) # (junk,oldext) = os.path.splitext(os.path.basename(oldfile))
oldfile = os.path.join(basefile,OldMediaID+oldext) # oldfile = os.path.join(basefile,OldMediaID+oldext)
newfile = os.path.join(newpath,NewMediaID+oldext) # newfile = os.path.join(newpath,NewMediaID+oldext)
ObjectMap[NewMediaID].set_path(newfile) # ObjectMap[NewMediaID].set_path(newfile)
ObjectMap[NewMediaID].setLocal(1) # ObjectMap[NewMediaID].setLocal(1)
try: # try:
shutil.copyfile(oldfile,newfile) # shutil.copyfile(oldfile,newfile)
try: # try:
shutil.copystat(oldfile,newfile) # shutil.copystat(oldfile,newfile)
except: # except:
pass # pass
except: # except:
if cl: # if cl:
print "Warning: media file %s was not found," \ # print "Warning: media file %s was not found," \
% os.path.basename(oldfile), "so it was ignored." # % os.path.basename(oldfile), "so it was ignored."
else: # else:
# File is lost => ask what to do (if we were not told yet) # # File is lost => ask what to do (if we were not told yet)
if missmedia_action == 0: # if missmedia_action == 0:
mmd = MissingMediaDialog(_("Media object could not be found"), # mmd = MissingMediaDialog(_("Media object could not be found"),
_("%(file_name)s is referenced in the database, but no longer exists. " # _("%(file_name)s is referenced in the database, but no longer exists. "
"The file may have been deleted or moved to a different location. " # "The file may have been deleted or moved to a different location. "
"You may choose to either remove the reference from the database, " # "You may choose to either remove the reference from the database, "
"keep the reference to the missing file, or select a new file." # "keep the reference to the missing file, or select a new file."
) % { 'file_name' : oldfile }, # ) % { 'file_name' : oldfile },
remove_clicked, leave_clicked, select_clicked) # remove_clicked, leave_clicked, select_clicked)
missmedia_action = mmd.default_action # missmedia_action = mmd.default_action
elif missmedia_action == 1: # elif missmedia_action == 1:
remove_clicked() # remove_clicked()
elif missmedia_action == 2: # elif missmedia_action == 2:
leave_clicked() # leave_clicked()
elif missmedia_action == 3: # elif missmedia_action == 3:
select_clicked() # select_clicked()
del parser del parser
return 1 return 1

View File

@ -2899,17 +2899,17 @@ class GrampsDB:
idVal - external ID number idVal - external ID number
map - map build by findPlace of external to gramp's IDs""" map - map build by findPlace of external to gramp's IDs"""
if map.has_key(idVal): if map.has_key(str(idVal)):
place = Place() place = Place()
data = self.place_map[map[idVal]] data = self.place_map[map[str(idVal)]]
place.unserialize(data) place.unserialize(data)
else: else:
place = Place() place = Place()
if self.place_map.has_key(idVal): if self.place_map.has_key(str(idVal)):
map[idVal] = self.add_place(place) map[str(idVal)] = self.add_place(place)
else: else:
place.set_id(idVal) place.set_id(str(idVal))
map[idVal] = self.add_place_as(place) map[str(idVal)] = self.add_place_as(place)
self.place_map.put(str(idVal),place.serialize()) self.place_map.put(str(idVal),place.serialize())
return place return place
@ -3082,7 +3082,7 @@ class GrampsDB:
person = Person() person = Person()
if map.has_key(idVal): if map.has_key(idVal):
person.serialize(self.person_map.get(str(map[idVal]))) person.unserialize(self.person_map.get(str(map[idVal])))
else: else:
if self.person_map.get(str(idVal)): if self.person_map.get(str(idVal)):
map[idVal] = self.add_person(person) map[idVal] = self.add_person(person)
@ -3100,15 +3100,15 @@ class GrampsDB:
idVal - external ID number idVal - external ID number
map - map build by findFamily of external to gramp's IDs""" map - map build by findFamily of external to gramp's IDs"""
if map.has_key(idVal): if map.has_key(str(idVal)):
family = Family() family = Family()
family.unserialize(self.family_map.get(str(map[idVal]))) family.unserialize(self.family_map.get(str(map[str(idVal)])))
else: else:
if self.family_map.has_key(idVal): if self.family_map.has_key(str(idVal)):
family = self.new_family() family = self.new_family()
else: else:
family = self.new_family_no_map(idVal) family = self.new_family_no_map(str(idVal))
map[idVal] = family.get_id() map[str(idVal)] = family.get_id()
return family return family
def find_source_no_conflicts(self,idVal,map): def find_source_no_conflicts(self,idVal,map):