From 93b256ee8b02ab01efbb0ec272617a2301aca46d Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Tue, 17 Jul 2007 02:37:33 +0000 Subject: [PATCH] * src/GrampsDb/_GrampsDbWriteXML.py (dump_source_ref): Do not write stext tag. * src/GrampsDbUtils/_ReadXML.py (GrampsParser.stop_stext): Import stext in sourceref as a note reference. svn: r8722 --- ChangeLog | 4 ++++ src/GrampsDb/_GrampsDbWriteXML.py | 4 +--- src/GrampsDbUtils/_ReadXML.py | 15 ++++++++++++--- src/RelLib/_NoteType.py | 1 - 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8e7762152..50ded49e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ 2007-07-16 Alex Roitman + * src/GrampsDb/_GrampsDbWriteXML.py (dump_source_ref): Do not + write stext tag. + * src/GrampsDbUtils/_ReadXML.py (GrampsParser.stop_stext): Import + stext in sourceref as a note reference. * src/GrampsDb/_GrampsBSDDB.py (convert_notes_13): Convert text field into a note on upgrade. * src/RelLib/_SourceRef.py (__init__): Remove text attribute; diff --git a/src/GrampsDb/_GrampsDbWriteXML.py b/src/GrampsDb/_GrampsDbWriteXML.py index 8abbdc420..94ae35d41 100644 --- a/src/GrampsDb/_GrampsDbWriteXML.py +++ b/src/GrampsDb/_GrampsDbWriteXML.py @@ -675,14 +675,13 @@ class GrampsDbXmlWriter(object): if source: p = source_ref.get_page() n = source_ref.get_note_list() - t = source_ref.get_text() 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: + if p == "" and n == [] and d.is_empty() and q == 2: self.g.write('\n' % ("_"+source.get_handle(), priv)) else: if q == 2: @@ -692,7 +691,6 @@ class GrampsDbXmlWriter(object): "_"+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) self.write_date(d,index+1) self.g.write("%s\n" % (" " * index)) diff --git a/src/GrampsDbUtils/_ReadXML.py b/src/GrampsDbUtils/_ReadXML.py index 23afc0a0a..0dcd02d6e 100644 --- a/src/GrampsDbUtils/_ReadXML.py +++ b/src/GrampsDbUtils/_ReadXML.py @@ -1858,10 +1858,18 @@ class GrampsParser(UpdateCallback): def stop_stext(self,tag): if self.use_p: self.use_p = 0 - note = fix_spaces(self.stext_list) + text = fix_spaces(self.stext_list) else: - note = tag - self.source_ref.set_text(note) + text = tag + # This is old XML. We no longer have "text" attribute in soure_ref. + # So we create a new note, commit, and add the handle to note list. + note = RelLib.Note() + note.handle = Utils.create_id() + note.private = self.source_ref.private + note.set(text) + note.type = RelLib.NoteType.SOURCE_TEXT + self.db.add_note(note,self.trans) + self.source_ref.add_note(note.handle) def stop_scomments(self,tag): if self.use_p: @@ -1871,6 +1879,7 @@ class GrampsParser(UpdateCallback): text = tag note = RelLib.Note() note.handle = Utils.create_id() + note.private = self.source_ref.private note.set(text) note.type.set(RelLib.NoteType.SOURCEREF) self.db.add_note(note,self.trans) diff --git a/src/RelLib/_NoteType.py b/src/RelLib/_NoteType.py index 1ddbdce79..0ed3afbfe 100644 --- a/src/RelLib/_NoteType.py +++ b/src/RelLib/_NoteType.py @@ -67,7 +67,6 @@ class NoteType(GrampsType): PERSONNAME = 20 # other common types SOURCE_TEXT = 21 # this is used for verbatim source text in SourceRef - _CUSTOM = CUSTOM _DEFAULT = GENERAL