[CalendarServer-changes] [11067] CalendarServer/trunk/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Fri Apr 19 08:55:02 PDT 2013


Revision: 11067
          http://trac.calendarserver.org//changeset/11067
Author:   sagen at apple.com
Date:     2013-04-19 08:55:02 -0700 (Fri, 19 Apr 2013)
Log Message:
-----------
Make ServerRoot absolute after reading the config so that all other paths become absolute and we don't run into issues where spawned processes are running with different working directories.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/stdconfig.py
    CalendarServer/trunk/twistedcaldav/test/test_stdconfig.py

Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py	2013-04-19 01:04:09 UTC (rev 11066)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py	2013-04-19 15:55:02 UTC (rev 11067)
@@ -1087,9 +1087,11 @@
     # Remove possible trailing slash from ServerRoot
     try:
         configDict["ServerRoot"] = configDict["ServerRoot"].rstrip("/")
+        configDict["ServerRoot"] = os.path.abspath(configDict["ServerRoot"])
     except KeyError:
         pass
 
+
     for root, relativePath in RELATIVE_PATHS:
         if root in configDict:
             if isinstance(relativePath, str):

Modified: CalendarServer/trunk/twistedcaldav/test/test_stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_stdconfig.py	2013-04-19 01:04:09 UTC (rev 11066)
+++ CalendarServer/trunk/twistedcaldav/test/test_stdconfig.py	2013-04-19 15:55:02 UTC (rev 11067)
@@ -15,6 +15,7 @@
 # limitations under the License.
 ##
 
+import os
 from cStringIO import StringIO
 
 from twext.python.filepath import CachingFilePath as FilePath
@@ -151,6 +152,12 @@
         _updateDataStore(configDict)
         self.assertEquals(configDict["ServerRoot"], "/a/b/c")
 
+        configDict = {
+            "ServerRoot" : "./a",
+        }
+        _updateDataStore(configDict)
+        self.assertEquals(configDict["ServerRoot"], os.path.join(os.getcwd(), "a"))
+
     def test_updateMultiProcess(self):
         def stubProcessCount(*args):
             return 3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130419/31302a67/attachment.html>


More information about the calendarserver-changes mailing list