[CalendarServer-changes] [4228] CalendarServer/trunk/twistedcaldav/config.py

source_changes at macosforge.org source_changes at macosforge.org
Mon May 11 14:11:02 PDT 2009


Revision: 4228
          http://trac.macosforge.org/projects/calendarserver/changeset/4228
Author:   wsanchez at apple.com
Date:     2009-05-11 14:11:02 -0700 (Mon, 11 May 2009)
Log Message:
-----------
Best way to check whether you can open a file is to try

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/config.py

Modified: CalendarServer/trunk/twistedcaldav/config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/config.py	2009-05-11 19:05:22 UTC (rev 4227)
+++ CalendarServer/trunk/twistedcaldav/config.py	2009-05-11 21:11:02 UTC (rev 4228)
@@ -637,12 +637,14 @@
     def loadConfig(self, configFile):
         self._configFile = configFile
 
-        if configFile and os.path.exists(configFile):
-            configDict = readPlist(configFile)
-            configDict = _cleanup(configDict)
-            self.update(ConfigDict(configDict))
-        elif configFile:
-            log.error("Configuration file does not exist or is inaccessible: %s" % (configFile,))
+        if configFile:
+            try:
+                configDict = readPlist(configFile)
+            except IOError, OSError:
+                log.error("Unable to open config file: %s" % (configFile,))
+            else:
+                configDict = _cleanup(configDict)
+                self.update(ConfigDict(configDict))
 
     @staticmethod
     def updateNotifications(self, items):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090511/8ed8882a/attachment-0001.html>


More information about the calendarserver-changes mailing list