Fixed syntax error generated by WriteXML with alternate locations for a place, have ReadXML return a better message on encountering a syntax error.
svn: r358
This commit is contained in:
parent
b3763eac37
commit
f8b032b66f
@ -141,10 +141,12 @@ def loadData(database, filename, callback):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
parser.parse(xml_file)
|
parser.parse(xml_file)
|
||||||
except SAXParseException:
|
except SAXParseException,msg:
|
||||||
GnomeErrorDialog(_("%s is a corrupt file") % filename)
|
line = string.split(str(msg),':')
|
||||||
import traceback
|
filemsg = _("%s is a corrupt file.") % filename
|
||||||
traceback.print_exc()
|
errtype = string.strip(line[3])
|
||||||
|
errmsg = _('A "%s" error on line %s was detected.') % (errtype,line[1])
|
||||||
|
GnomeErrorDialog("%s\n%s" % (filemsg,errmsg))
|
||||||
return 0
|
return 0
|
||||||
except IOError,msg:
|
except IOError,msg:
|
||||||
GnomeErrorDialog(_("Error reading %s") % filename + "\n" + str(msg))
|
GnomeErrorDialog(_("Error reading %s") % filename + "\n" + str(msg))
|
||||||
|
@ -453,9 +453,9 @@ def exportData(database, filename, callback):
|
|||||||
country = fix(loc.get_country())
|
country = fix(loc.get_country())
|
||||||
county = fix(loc.get_county())
|
county = fix(loc.get_county())
|
||||||
if city or state or country or county:
|
if city or state or country or county:
|
||||||
g.write(' <location city="%s" ' % city)
|
g.write(' <location city="%s"' % city)
|
||||||
g.write('county="%s" state="%s" ' % (county,state))
|
g.write(' county="%s" state="%s"' % (county,state))
|
||||||
g.write('country="%s"/>\n' % country)
|
g.write(' country="%s"/>\n' % country)
|
||||||
for loc in place.get_alternate_locations():
|
for loc in place.get_alternate_locations():
|
||||||
city = fix(loc.get_city())
|
city = fix(loc.get_city())
|
||||||
state = fix(loc.get_state())
|
state = fix(loc.get_state())
|
||||||
@ -463,8 +463,8 @@ def exportData(database, filename, callback):
|
|||||||
county = fix(loc.get_county())
|
county = fix(loc.get_county())
|
||||||
if city or state or country or county:
|
if city or state or country or county:
|
||||||
g.write(' <location type="alternate"')
|
g.write(' <location type="alternate"')
|
||||||
g.write('city="%s" county="%s" state="%s" country="%s"/>\n' \
|
g.write(' city="%s" county="%s"' % (city,county))
|
||||||
% (city,county,state,country))
|
g.write(' state="%s" country="%s"/>\n' % (state,country))
|
||||||
for photo in place.getPhotoList():
|
for photo in place.getPhotoList():
|
||||||
path = photo.getPath()
|
path = photo.getPath()
|
||||||
l = len(fileroot)
|
l = len(fileroot)
|
||||||
|
Loading…
Reference in New Issue
Block a user