* 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
This commit is contained in:
Alex Roitman 2007-07-17 02:37:33 +00:00
parent 2a41dbfd03
commit 93b256ee8b
4 changed files with 17 additions and 7 deletions

View File

@ -1,4 +1,8 @@
2007-07-16 Alex Roitman <shura@gramps-project.org>
* 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;

View File

@ -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('<sourceref hlink="%s"%s/>\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</sourceref>\n" % (" " * index))

View File

@ -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)

View File

@ -68,7 +68,6 @@ class NoteType(GrampsType):
# other common types
SOURCE_TEXT = 21 # this is used for verbatim source text in SourceRef
_CUSTOM = CUSTOM
_DEFAULT = GENERAL