dabo Commit
Revision 5776
Date: 2010-04-05 05:49:17 -0700 (Mon, 05 Apr 2010)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5776
Changed:
U trunk/dabo/dApp.py
Log:
Modified the .cnxml parsing in _initDB() so that if there is a misformed XML
file error, that error is recorded in the Dabo error log instead of causing the
app to crash at that point.
Diff:
Modified: trunk/dabo/dApp.py
===================================================================
--- trunk/dabo/dApp.py 2010-04-04 16:42:33 UTC (rev 5775)
+++ trunk/dabo/dApp.py 2010-04-05 12:49:17 UTC (rev 5776)
@@ -14,6 +14,7 @@
import logging
from cStringIO import StringIO
from zipfile import ZipFile
+from xml.sax._exceptions import SAXParseException
import dabo
import dabo.ui
import dabo.db
@@ -989,7 +990,11 @@
def getConnectionsFromFile(self, filePath):
"""Given an absolute path to a .cnxml file, return the
connection defs."""
- connDefs = importConnections(filePath, useHomeDir=True)
+ try:
+ connDefs = importConnections(filePath, useHomeDir=True)
+ except SAXParseException, e:
+ dabo.errorLog.write(_("Error parsing '%s': %s") %
(filePath, e))
+ return {}
# Convert the connect info dicts to dConnectInfo instances:
for k,v in connDefs.items():
ci = dabo.db.dConnectInfo()
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]