dabo Commit
Revision 5071
Date: 2009-02-22 10:13:20 -0800 (Sun, 22 Feb 2009)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5071

Changed:
U   trunk/dabo/dApp.py

Log:
Added code to handle the case where a non-existent file is passed to 
addConnectFile(). Trac issue #1199.


Diff:
Modified: trunk/dabo/dApp.py
===================================================================
--- trunk/dabo/dApp.py  2009-02-22 18:08:02 UTC (rev 5070)
+++ trunk/dabo/dApp.py  2009-02-22 18:13:20 UTC (rev 5071)
@@ -1015,8 +1015,10 @@
 
        def addConnectFile(self, connFile):
                """Accepts a cnxml file path, and reads in the connections
-               defined in it, adding them to self.dbConnectionDefs.
+               defined in it, adding them to self.dbConnectionDefs. If the 
+               file cannot be found, an exception is raised.
                """
+               origFile = connFile
                if not os.path.exists(connFile):
                        homeFile = os.path.join(self.HomeDirectory, connFile)
                        if os.path.exists(homeFile):
@@ -1038,6 +1040,8 @@
                                ci.setConnInfo(v)
                                self.dbConnectionDefs[k] = ci
                                self.dbConnectionNameToFiles[k] = connFile
+               else:
+                       raise IOError(_("File '%s' passed to 
dApp.addConnectFile() does not exist.") % origFile)
 
 
        def getStandardAppDirectory(self, dirname, start=None):



_______________________________________________
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]

Reply via email to