[CalendarServer-changes] [13921] CalendarServer/trunk/calendarserver/tools/config.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Aug 27 10:15:25 PDT 2014


Revision: 13921
          http://trac.calendarserver.org//changeset/13921
Author:   sagen at apple.com
Date:     2014-08-27 10:15:25 -0700 (Wed, 27 Aug 2014)
Log Message:
-----------
Safely write plist using FilePath.setContent( )

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/config.py

Modified: CalendarServer/trunk/calendarserver/tools/config.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/config.py	2014-08-27 17:15:01 UTC (rev 13920)
+++ CalendarServer/trunk/calendarserver/tools/config.py	2014-08-27 17:15:25 UTC (rev 13921)
@@ -31,6 +31,9 @@
 from plistlib import readPlistFromString, writePlistToString
 from twistedcaldav.config import config, ConfigDict, ConfigurationError, mergeData
 from twistedcaldav.stdconfig import DEFAULT_CONFIG_FILE
+from twisted.python.filepath import FilePath
+
+
 WRITABLE_CONFIG_KEYS = [
     "Authentication.Basic.AllowedOverWireUnencrypted",
     "Authentication.Basic.Enabled",
@@ -450,7 +453,9 @@
         @type restart: C{bool}
         """
         if self.dirty:
-            plistlib.writePlist(self.currentConfigSubset, self.fileName)
+            content = writePlistToString(self.currentConfigSubset)
+            fp = FilePath(self.fileName)
+            fp.setContent(content)
             self.dirty = False
             if restart:
                 restartService(self.config.PIDFile)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140827/adadce32/attachment.html>


More information about the calendarserver-changes mailing list