2007-05-10 Benny Malengier <bm@cage.ugent.be>

* src/GrampsDb/_ReadXML.py: partly fix #1053, import privacy of person, family,
        media, source, place and repo correct. Still to do: sourceref and lds_ordinance



svn: r8459
This commit is contained in:
Benny Malengier 2007-05-10 22:07:25 +00:00
parent f8b10aff87
commit 11190e66d9
2 changed files with 26 additions and 10 deletions

View File

@ -1,3 +1,7 @@
2007-05-10 Benny Malengier <bm@cage.ugent.be>
* src/GrampsDb/_ReadXML.py: partly fix #1053, import privacy of person, family,
media, source, place and repo correct. Still to do: sourceref and lds_ordinance
2007-05-08 Don Allingham <don@gramps-project.org> 2007-05-08 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_GrampsDbBase.py (GrampsDbBookmarks.insert): fix * src/GrampsDb/_GrampsDbBase.py (GrampsDbBookmarks.insert): fix
bookmark insertion (#1050) bookmark insertion (#1050)

View File

@ -711,6 +711,9 @@ class GrampsParser(UpdateCallback):
self.placeobj.set_gramps_id(gramps_id) self.placeobj.set_gramps_id(gramps_id)
except KeyError: except KeyError:
self.placeobj = self.find_place_by_gramps_id(gramps_id) self.placeobj = self.find_place_by_gramps_id(gramps_id)
self.placeobj.private = bool(attrs.get("priv"))
# GRAMPS LEGACY: title in the placeobj tag # GRAMPS LEGACY: title in the placeobj tag
self.placeobj.title = attrs.get('title','') self.placeobj.title = attrs.get('title','')
self.locations = 0 self.locations = 0
@ -924,6 +927,7 @@ class GrampsParser(UpdateCallback):
except KeyError: except KeyError:
self.person = self.find_person_by_gramps_id(new_id) self.person = self.find_person_by_gramps_id(new_id)
self.person.private = bool(attrs.get("priv"))
# Old and new markers: complete=1 and marker=word both have to work # Old and new markers: complete=1 and marker=word both have to work
if attrs.get('complete'): # this is only true for complete=1 if attrs.get('complete'): # this is only true for complete=1
self.person.marker.set(RelLib.MarkerType.COMPLETE) self.person.marker.set(RelLib.MarkerType.COMPLETE)
@ -1020,6 +1024,9 @@ class GrampsParser(UpdateCallback):
self.family.set_gramps_id(gramps_id) self.family.set_gramps_id(gramps_id)
except KeyError: except KeyError:
self.family = self.find_family_by_gramps_id(gramps_id) self.family = self.find_family_by_gramps_id(gramps_id)
self.family.private = bool(attrs.get("priv"))
# GRAMPS LEGACY: the type now belongs to <rel> tag # GRAMPS LEGACY: the type now belongs to <rel> tag
# Here we need to support old format of <family type="Married"> # Here we need to support old format of <family type="Married">
if attrs.has_key('type'): if attrs.has_key('type'):
@ -1092,7 +1099,7 @@ class GrampsParser(UpdateCallback):
self.name.set_type(RelLib.NameType.UNKNOWN) self.name.set_type(RelLib.NameType.UNKNOWN)
else: else:
self.name.type.set_from_xml_str(name_type) self.name.type.set_from_xml_str(name_type)
self.name.set_private = bool(attrs.get("priv")) self.name.private = bool(attrs.get("priv"))
self.alt_name = bool(attrs.get("alt")) self.alt_name = bool(attrs.get("alt"))
try: try:
sort_as = int(attrs["sort"]) sort_as = int(attrs["sort"])
@ -1152,20 +1159,19 @@ class GrampsParser(UpdateCallback):
self.note.private = self.attribute.private self.note.private = self.attribute.private
elif self.object: elif self.object:
self.note.type.set(RelLib.NoteType.MEDIA) self.note.type.set(RelLib.NoteType.MEDIA)
# self.note.private = ... object has no private ?? self.note.private = self.object.private
elif self.objref: elif self.objref:
self.note.type.set(RelLib.NoteType.MEDIAREF) self.note.type.set(RelLib.NoteType.MEDIAREF)
self.note.private = self.objref.private self.note.private = self.objref.private
elif self.photo: elif self.photo:
self.note.type.set(RelLib.NoteType.MEDIA) self.note.type.set(RelLib.NoteType.MEDIA)
# ?? photo no privacy? only pref: self.pref.get_privacy()?? self.note.private = self.photo.private
elif self.name: elif self.name:
self.note.type.set(RelLib.NoteType.PERSONNAME) self.note.type.set(RelLib.NoteType.PERSONNAME)
# ?? error in self.name ?? set_private instead of private ?? self.note.private = self.name.private
self.note.private = self.name.set_private
elif self.source: elif self.source:
self.note.type.set(RelLib.NoteType.SOURCE) self.note.type.set(RelLib.NoteType.SOURCE)
# ?? self.note.private = self.source. ?? no private ?? self.note.private = self.source.private
elif self.event: elif self.event:
self.note.type.set(RelLib.NoteType.EVENT) self.note.type.set(RelLib.NoteType.EVENT)
self.note.private = self.event.private self.note.private = self.event.private
@ -1174,22 +1180,22 @@ class GrampsParser(UpdateCallback):
self.note.private = self.personref.private self.note.private = self.personref.private
elif self.person: elif self.person:
self.note.type.set(RelLib.NoteType.PERSON) self.note.type.set(RelLib.NoteType.PERSON)
# ?? self.note.private = self.person ... ?? no private ?? self.note.private = self.person.private
elif self.childref: elif self.childref:
self.note.type.set(RelLib.NoteType.CHILDREF) self.note.type.set(RelLib.NoteType.CHILDREF)
self.note.private = self.childref.private self.note.private = self.childref.private
elif self.family: elif self.family:
self.note.type.set(RelLib.NoteType.FAMILY) self.note.type.set(RelLib.NoteType.FAMILY)
# ?? self.note.private = self.family ... ?? no private ?? self.note.private = self.family.private
elif self.placeobj: elif self.placeobj:
self.note.type.set(RelLib.NoteType.PLACE) self.note.type.set(RelLib.NoteType.PLACE)
# ?? self.note.private = self.family ... ?? no private ?? self.note.private = self.placeobj.private
elif self.eventref: elif self.eventref:
self.note.type.set(RelLib.NoteType.EVENTREF) self.note.type.set(RelLib.NoteType.EVENTREF)
self.note.private = self.eventref.private self.note.private = self.eventref.private
elif self.repo: elif self.repo:
self.note.type.set(RelLib.NoteType.REPO) self.note.type.set(RelLib.NoteType.REPO)
# ?? self.note.private = self.repo ... ?? no private ?? self.note.private = self.repo.private
elif self.reporef: elif self.reporef:
self.note.type.set(RelLib.NoteType.REPOREF) self.note.type.set(RelLib.NoteType.REPOREF)
# reporef has no private, correct # reporef has no private, correct
@ -1285,6 +1291,8 @@ class GrampsParser(UpdateCallback):
except KeyError: except KeyError:
self.source = self.find_source_by_gramps_id(gramps_id) self.source = self.find_source_by_gramps_id(gramps_id)
self.source.private = bool(attrs.get("priv"))
def start_reporef(self,attrs): def start_reporef(self,attrs):
self.reporef = RelLib.RepoRef() self.reporef = RelLib.RepoRef()
try: try:
@ -1337,6 +1345,7 @@ class GrampsParser(UpdateCallback):
# the old format of <object src="blah"...> # the old format of <object src="blah"...>
self.object.mime = attrs.get('mime','') self.object.mime = attrs.get('mime','')
self.object.desc = attrs.get('description','') self.object.desc = attrs.get('description','')
self.object.private = bool(attrs.get("priv"))
src = attrs.get("src",'') src = attrs.get("src",'')
if src: if src:
if not os.path.isabs(src): if not os.path.isabs(src):
@ -1353,6 +1362,8 @@ class GrampsParser(UpdateCallback):
except KeyError: except KeyError:
self.repo = self.find_repository_by_gramps_id(gramps_id) self.repo = self.find_repository_by_gramps_id(gramps_id)
self.repo.private = bool(attrs.get("priv"))
def stop_people(self,*tag): def stop_people(self,*tag):
pass pass
@ -1383,6 +1394,7 @@ class GrampsParser(UpdateCallback):
self.photo.set_description(attrs[key]) self.photo.set_description(attrs[key])
elif key == "priv": elif key == "priv":
self.pref.set_privacy(int(attrs[key])) self.pref.set_privacy(int(attrs[key]))
self.photo.set_privacy(int(attrs[key]))
elif key == "src": elif key == "src":
src = attrs["src"] src = attrs["src"]
if not os.path.isabs(src): if not os.path.isabs(src):