diff --git a/gramps/src/GrampsParser.py b/gramps/src/GrampsParser.py
index 84732b2cf..60f679d83 100644
--- a/gramps/src/GrampsParser.py
+++ b/gramps/src/GrampsParser.py
@@ -82,6 +82,7 @@ class GrampsParser(handler.ContentHandler):
self.source = None
self.sourceRef = None
self.is_import = is_import
+ self.in_address = 0
self.resname = ""
self.resaddr = ""
@@ -157,6 +158,7 @@ class GrampsParser(handler.ContentHandler):
#
#---------------------------------------------------------------------
def start_address(self,attrs):
+ self.in_address = 1
self.address = Address()
self.person.addAddress(self.address)
@@ -394,6 +396,14 @@ class GrampsParser(handler.ContentHandler):
#---------------------------------------------------------------------
def stop_attribute(self,tag):
self.attribute.setValue(tag)
+
+ #---------------------------------------------------------------------
+ #
+ #
+ #
+ #---------------------------------------------------------------------
+ def stop_address(self,tag):
+ self.in_address = 0
#---------------------------------------------------------------------
#
@@ -447,7 +457,10 @@ class GrampsParser(handler.ContentHandler):
#---------------------------------------------------------------------
def stop_date(self,tag):
if tag:
- self.event.getDateObj().quick_set(tag)
+ if self.in_address:
+ self.address.setDate(tag)
+ else:
+ self.event.getDateObj().quick_set(tag)
#---------------------------------------------------------------------
#
@@ -502,14 +515,6 @@ class GrampsParser(handler.ContentHandler):
date.quick_set(tag)
self.source.setDate(date)
- def stop_date_start(self,tag):
- date = self.address.getStartDateObj()
- date.quick_set(tag)
-
- def stop_date_stop(self,tag):
- date = self.address.getStopDateObj()
- date.quick_set(tag)
-
def stop_street(self,tag):
self.address.setStreet(tag)
@@ -705,7 +710,7 @@ class GrampsParser(handler.ContentHandler):
self.person.addAlternateName(self.name)
func_map = {
- "address" : (start_address, None),
+ "address" : (start_address, stop_address),
"aka" : (start_name, stop_aka),
"attribute" : (start_attribute, stop_attribute),
"bookmark" : (start_bmark, None),
@@ -756,11 +761,9 @@ class GrampsParser(handler.ContentHandler):
"sources" : (start_sources, None),
"spage" : (None, stop_spage),
"spubinfo" : (None, stop_spubinfo),
- "date_start" : (None, stop_date_start),
"state" : (None, stop_state),
"stext" : (None, stop_stext),
"stitle" : (None, stop_stitle),
- "date_stop" : (None, stop_date_stop),
"street" : (None, stop_street),
"suffix" : (None, stop_suffix),
"title" : (None, stop_title),
diff --git a/gramps/src/ReadXML.py b/gramps/src/ReadXML.py
index 2fd37b509..519ad14d9 100644
--- a/gramps/src/ReadXML.py
+++ b/gramps/src/ReadXML.py
@@ -114,12 +114,18 @@ def loadData(database, filename, callback):
parser.parse(xml_file)
except xml.sax.SAXParseException:
GnomeErrorDialog(_("%s is a corrupt file") % filename)
+ import traceback
+ traceback.print_exc()
return 0
except IOError,msg:
GnomeErrorDialog(_("Error reading %s") % filename + "\n" + str(msg))
+ import traceback
+ traceback.print_exc()
return 0
except:
GnomeErrorDialog(_("Error reading %s") % filename)
+ import traceback
+ traceback.print_exc()
return 0
diff --git a/gramps/src/WriteXML.py b/gramps/src/WriteXML.py
index a6cc94a5d..c8a71900d 100644
--- a/gramps/src/WriteXML.py
+++ b/gramps/src/WriteXML.py
@@ -101,12 +101,19 @@ def dump_my_event(g,name,event):
if source:
sourceRef = source.getBase()
if sourceRef:
- g.write("\n" % sourceRef.getId())
- write_line(g,"spage",source.getPage())
- writeNote(g,"scomments",source.getComments())
- writeNote(g,"stext",source.getText())
- write_line(g,"sdate",source.getDate().getSaveDate())
- g.write("\n")
+ p = source.getPage()
+ c = source.getComments()
+ t = source.getText()
+ d = source.getDate().getSaveDate()
+ if p == "" and c == "" and t == "" and d == "":
+ g.write("\n" % sourceRef.getId())
+ else:
+ g.write("\n" % sourceRef.getId())
+ write_line(g,"spage",p)
+ writeNote(g,"scomments",c)
+ writeNote(g,"stext",t)
+ write_line(g,"sdate",c)
+ g.write("\n")
g.write("\n")
#-------------------------------------------------------------------------
@@ -197,10 +204,8 @@ def exportData(database, filename, callback):
g.write("\n")
total = len(personList) + len(familyList)
@@ -239,12 +244,7 @@ def exportData(database, filename, callback):
g.write("\n")
for address in person.getAddressList():
g.write('\n')
- g.write('')
- g.write(address.getStartDateObj().getSaveDate())
- g.write('\n')
- g.write('')
- g.write(address.getStopDateObj().getSaveDate())
- g.write('\n')
+ write_line(g,"date",address.getDateObj().getSaveDate())
write_line(g,"street",address.getStreet())
write_line(g,"city",address.getCity())
write_line(g,"state",address.getState())