only check connections XML if file can be parsed

This commit is contained in:
Tom Kralidis 2015-02-27 07:34:28 -05:00
parent c33c097706
commit e0acd90d0d

View File

@ -81,6 +81,9 @@ def get_connections_from_file(parent, filename):
error = 0
try:
doc = etree.parse(filename).getroot()
if doc.tag != 'qgsCSWConnections':
error = 1
msg = parent.tr('Invalid CSW connections XML.')
except etree.ParseError, err:
error = 1
msg = parent.tr('Cannot parse XML file: %s' % err)
@ -88,10 +91,6 @@ def get_connections_from_file(parent, filename):
error = 1
msg = parent.tr('Cannot open file: %s' % err)
if doc.tag != 'qgsCSWConnections':
error = 1
msg = parent.tr('Invalid CSW connections XML.')
if error == 1:
QMessageBox.information(parent, parent.tr('Loading Connections'), msg)
return