From 04df3f6e8977475241bc94e50a317a68791c0e30 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Fri, 11 May 2007 22:31:39 +0000 Subject: [PATCH] 2007-05-11 Benny Malengier * src/GrampsDbUtils/_ReadXML.py: * src/GrampsDb/_GrampsDbWriteXML.py: Merge gramps2 privacy changes of Don, add privacy to note of sourceref and lds_ord * src/GrampsDbUtils/_ReadXML.py: partly fix #1053, import privacy of person, family, svn: r8463 --- ChangeLog | 7 ++++++- src/GrampsDb/_GrampsDbWriteXML.py | 14 ++++++++++---- src/GrampsDbUtils/_ReadXML.py | 11 +++++++---- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index a4c03671a..b536ad7cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ +2007-05-11 Benny Malengier + * src/GrampsDbUtils/_ReadXML.py: + * src/GrampsDb/_GrampsDbWriteXML.py: + Merge gramps2 privacy changes of Don, add privacy to note of sourceref and lds_ord + 2007-05-10 Benny Malengier - * src/GrampsDb/_ReadXML.py: partly fix #1053, import privacy of person, family, + * src/GrampsDbUtils/_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 diff --git a/src/GrampsDb/_GrampsDbWriteXML.py b/src/GrampsDb/_GrampsDbWriteXML.py index 3921126a0..ad0d91145 100644 --- a/src/GrampsDb/_GrampsDbWriteXML.py +++ b/src/GrampsDb/_GrampsDbWriteXML.py @@ -649,7 +649,9 @@ class GrampsDbXmlWriter(object): sp = " " * index sp2 = " " * (index+1) - self.g.write('%s\n' % (sp,name)) + + priv = conf_priv(ord) + self.g.write('%s\n' % (sp,name,priv)) dateobj = ord.get_date_object() if dateobj and not dateobj.is_empty(): self.write_date(dateobj,index+1) @@ -677,13 +679,17 @@ class GrampsDbXmlWriter(object): d = source_ref.get_date_object() q = source_ref.get_confidence_level() self.g.write(" " * index) + + priv = conf_priv(source_ref) + if p == "" and n == [] and t == "" and d.is_empty() and q == 2: - self.g.write('\n' % ("_"+source.get_handle())) + self.g.write('\n' % ("_"+source.get_handle(), priv)) else: if q == 2: - self.g.write('\n' % ("_"+source.get_handle())) + self.g.write('\n' % ("_"+source.get_handle(), priv)) else: - self.g.write('\n' % ("_"+source.get_handle(),q)) + self.g.write('\n' % ( + "_"+source.get_handle(),q, priv)) self.write_line("spage",p,index+1) self.write_note_list(n,index+1) self.write_text("stext",t,index+1) diff --git a/src/GrampsDbUtils/_ReadXML.py b/src/GrampsDbUtils/_ReadXML.py index 285249995..6c3a975b4 100644 --- a/src/GrampsDbUtils/_ReadXML.py +++ b/src/GrampsDbUtils/_ReadXML.py @@ -666,6 +666,7 @@ class GrampsParser(UpdateCallback): def start_lds_ord(self,attrs): self.ord = RelLib.LdsOrd() self.ord.set_type_from_xml(attrs['type']) + self.ord.private = bool(attrs.get("priv")) if self.person: self.person.lds_ord_list.append(self.ord) elif self.family: @@ -702,6 +703,7 @@ class GrampsParser(UpdateCallback): except KeyError: gramps_id = self.map_pid(attrs['ref']) self.placeobj = self.find_place_by_gramps_id(gramps_id) + self.placeobj.private = bool(attrs.get("priv")) def start_placeobj(self,attrs): gramps_id = self.map_pid(attrs['id']) @@ -1006,7 +1008,7 @@ class GrampsParser(UpdateCallback): url = RelLib.Url() url.path = attrs["href"] url.set_description(attrs.get("description",'')) - url.privacy = bool(attrs.get('priv')) + url.private = bool(attrs.get('priv')) url.type.set_from_xml_str(attrs['type']) if self.person: self.person.add_url(url) @@ -1147,13 +1149,13 @@ class GrampsParser(UpdateCallback): self.note.format = int(attrs.get('format',RelLib.Note.FLOWED)) if self.source_ref: self.note.type.set(RelLib.NoteType.SOURCEREF) - # self.note.private = ... sourceref has no private ?? + self.note.private = self.source_ref.private elif self.address: self.note.type.set(RelLib.NoteType.ADDRESS) self.note.private = self.address.private elif self.ord: self.note.type.set(elLib.NoteType.LDS) - # self.note.private = ... lds_ord has no private ?? + self.note.private = self.ord.private elif self.attribute: self.note.type.set(RelLib.NoteType.ATTRIBUTE) self.note.private = self.attribute.private @@ -1254,6 +1256,8 @@ class GrampsParser(UpdateCallback): self.source_ref.ref = handle self.source_ref.confidence = int(attrs.get("conf",self.conf)) + self.source_ref.private = bool(attrs.get("priv")) + if self.photo: self.photo.add_source_reference(self.source_ref) elif self.ord: @@ -1290,7 +1294,6 @@ class GrampsParser(UpdateCallback): self.source.set_gramps_id(gramps_id) except KeyError: self.source = self.find_source_by_gramps_id(gramps_id) - self.source.private = bool(attrs.get("priv")) def start_reporef(self,attrs):