* 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:
@ -1,4 +1,8 @@
|
|||||||
2007-07-16 Alex Roitman <shura@gramps-project.org>
|
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
|
* src/GrampsDb/_GrampsBSDDB.py (convert_notes_13): Convert text
|
||||||
field into a note on upgrade.
|
field into a note on upgrade.
|
||||||
* src/RelLib/_SourceRef.py (__init__): Remove text attribute;
|
* src/RelLib/_SourceRef.py (__init__): Remove text attribute;
|
||||||
|
@ -675,14 +675,13 @@ class GrampsDbXmlWriter(object):
|
|||||||
if source:
|
if source:
|
||||||
p = source_ref.get_page()
|
p = source_ref.get_page()
|
||||||
n = source_ref.get_note_list()
|
n = source_ref.get_note_list()
|
||||||
t = source_ref.get_text()
|
|
||||||
d = source_ref.get_date_object()
|
d = source_ref.get_date_object()
|
||||||
q = source_ref.get_confidence_level()
|
q = source_ref.get_confidence_level()
|
||||||
self.g.write(" " * index)
|
self.g.write(" " * index)
|
||||||
|
|
||||||
priv = conf_priv(source_ref)
|
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))
|
self.g.write('<sourceref hlink="%s"%s/>\n' % ("_"+source.get_handle(), priv))
|
||||||
else:
|
else:
|
||||||
if q == 2:
|
if q == 2:
|
||||||
@ -692,7 +691,6 @@ class GrampsDbXmlWriter(object):
|
|||||||
"_"+source.get_handle(),q, priv))
|
"_"+source.get_handle(),q, priv))
|
||||||
self.write_line("spage",p,index+1)
|
self.write_line("spage",p,index+1)
|
||||||
self.write_note_list(n,index+1)
|
self.write_note_list(n,index+1)
|
||||||
self.write_text("stext",t,index+1)
|
|
||||||
self.write_date(d,index+1)
|
self.write_date(d,index+1)
|
||||||
self.g.write("%s</sourceref>\n" % (" " * index))
|
self.g.write("%s</sourceref>\n" % (" " * index))
|
||||||
|
|
||||||
|
@ -1858,10 +1858,18 @@ class GrampsParser(UpdateCallback):
|
|||||||
def stop_stext(self,tag):
|
def stop_stext(self,tag):
|
||||||
if self.use_p:
|
if self.use_p:
|
||||||
self.use_p = 0
|
self.use_p = 0
|
||||||
note = fix_spaces(self.stext_list)
|
text = fix_spaces(self.stext_list)
|
||||||
else:
|
else:
|
||||||
note = tag
|
text = tag
|
||||||
self.source_ref.set_text(note)
|
# 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):
|
def stop_scomments(self,tag):
|
||||||
if self.use_p:
|
if self.use_p:
|
||||||
@ -1871,6 +1879,7 @@ class GrampsParser(UpdateCallback):
|
|||||||
text = tag
|
text = tag
|
||||||
note = RelLib.Note()
|
note = RelLib.Note()
|
||||||
note.handle = Utils.create_id()
|
note.handle = Utils.create_id()
|
||||||
|
note.private = self.source_ref.private
|
||||||
note.set(text)
|
note.set(text)
|
||||||
note.type.set(RelLib.NoteType.SOURCEREF)
|
note.type.set(RelLib.NoteType.SOURCEREF)
|
||||||
self.db.add_note(note,self.trans)
|
self.db.add_note(note,self.trans)
|
||||||
|
@ -68,7 +68,6 @@ class NoteType(GrampsType):
|
|||||||
# other common types
|
# other common types
|
||||||
SOURCE_TEXT = 21 # this is used for verbatim source text in SourceRef
|
SOURCE_TEXT = 21 # this is used for verbatim source text in SourceRef
|
||||||
|
|
||||||
|
|
||||||
_CUSTOM = CUSTOM
|
_CUSTOM = CUSTOM
|
||||||
_DEFAULT = GENERAL
|
_DEFAULT = GENERAL
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user