[CalendarServer-changes] [6414] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Tue Oct 12 09:34:12 PDT 2010
Revision: 6414
http://trac.macosforge.org/projects/calendarserver/changeset/6414
Author: sagen at apple.com
Date: 2010-10-12 09:34:10 -0700 (Tue, 12 Oct 2010)
Log Message:
-----------
Automatically set EnableCalDAV and EnableCardDAV to True for command line utilities
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/util.py
CalendarServer/trunk/twistedcaldav/stdconfig.py
Added Paths:
-----------
CalendarServer/trunk/calendarserver/tools/test/test_util.py
CalendarServer/trunk/calendarserver/tools/test/util/
CalendarServer/trunk/calendarserver/tools/test/util/caldavd.plist
Added: CalendarServer/trunk/calendarserver/tools/test/test_util.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/test_util.py (rev 0)
+++ CalendarServer/trunk/calendarserver/tools/test/test_util.py 2010-10-12 16:34:10 UTC (rev 6414)
@@ -0,0 +1,28 @@
+##
+# Copyright (c) 2005-2010 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+import os
+from twistedcaldav.test.util import TestCase
+from calendarserver.tools.util import loadConfig
+
+class UtilTestCase(TestCase):
+
+ def test_loadConfig(self):
+ testRoot = os.path.join(os.path.dirname(__file__), "util")
+ configPath = os.path.join(testRoot, "caldavd.plist")
+ config = loadConfig(configPath)
+ self.assertEquals(config.EnableCalDAV, True)
+ self.assertEquals(config.EnableCardDAV, True)
Added: CalendarServer/trunk/calendarserver/tools/test/util/caldavd.plist
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/util/caldavd.plist (rev 0)
+++ CalendarServer/trunk/calendarserver/tools/test/util/caldavd.plist 2010-10-12 16:34:10 UTC (rev 6414)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>EnableCalDAV</key>
+ <false/>
+ <key>EnableCardDAV</key>
+ <false/>
+ </dict>
+</plist>
Modified: CalendarServer/trunk/calendarserver/tools/util.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/util.py 2010-10-11 19:10:41 UTC (rev 6413)
+++ CalendarServer/trunk/calendarserver/tools/util.py 2010-10-12 16:34:10 UTC (rev 6414)
@@ -47,6 +47,10 @@
log = Logger()
def loadConfig(configFileName):
+ """
+ Helper method for command-line utilities to load configuration plist
+ and override certain values.
+ """
if configFileName is None:
configFileName = DEFAULT_CONFIG_FILE
@@ -55,6 +59,10 @@
config.load(configFileName)
+ # Command-line utilities always want these enabled:
+ config.EnableCalDAV = True
+ config.EnableCardDAV = True
+
return config
def getDirectory():
Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py 2010-10-11 19:10:41 UTC (rev 6413)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py 2010-10-12 16:34:10 UTC (rev 6414)
@@ -983,7 +983,7 @@
def _updateCompliance(configDict):
if not (configDict.EnableCalDAV or configDict.EnableCardDAV):
- raise ConfigurationError("Must have at least one of 'EnableCalDAV' or 'EnableCardDAV' set to True")
+ log.warn("Neither 'EnableCalDAV' nor 'EnableCardDAV' are set to True")
if configDict.EnableCalDAV:
if configDict.Scheduling.CalDAV.OldDraftCompatibility:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20101012/355f6e5b/attachment.html>
More information about the calendarserver-changes
mailing list