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:
|
||||
parser.parse(xml_file)
|
||||
except SAXParseException:
|
||||
GnomeErrorDialog(_("%s is a corrupt file") % filename)
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
except SAXParseException,msg:
|
||||
line = string.split(str(msg),':')
|
||||
filemsg = _("%s is a corrupt file.") % filename
|
||||
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
|
||||
except IOError,msg:
|
||||
GnomeErrorDialog(_("Error reading %s") % filename + "\n" + str(msg))
|
||||
|
@ -453,9 +453,9 @@ def exportData(database, filename, callback):
|
||||
country = fix(loc.get_country())
|
||||
county = fix(loc.get_county())
|
||||
if city or state or country or county:
|
||||
g.write(' <location city="%s" ' % city)
|
||||
g.write('county="%s" state="%s" ' % (county,state))
|
||||
g.write('country="%s"/>\n' % country)
|
||||
g.write(' <location city="%s"' % city)
|
||||
g.write(' county="%s" state="%s"' % (county,state))
|
||||
g.write(' country="%s"/>\n' % country)
|
||||
for loc in place.get_alternate_locations():
|
||||
city = fix(loc.get_city())
|
||||
state = fix(loc.get_state())
|
||||
@ -463,8 +463,8 @@ def exportData(database, filename, callback):
|
||||
county = fix(loc.get_county())
|
||||
if city or state or country or county:
|
||||
g.write(' <location type="alternate"')
|
||||
g.write('city="%s" county="%s" state="%s" country="%s"/>\n' \
|
||||
% (city,county,state,country))
|
||||
g.write(' city="%s" county="%s"' % (city,county))
|
||||
g.write(' state="%s" country="%s"/>\n' % (state,country))
|
||||
for photo in place.getPhotoList():
|
||||
path = photo.getPath()
|
||||
l = len(fileroot)
|
||||
|
Loading…
Reference in New Issue
Block a user