[CalendarServer-changes] [5112] CalendarServer/trunk/calendarserver/tools
source_changes at macosforge.org
source_changes at macosforge.org
Sat Feb 13 11:25:01 PST 2010
Revision: 5112
http://trac.macosforge.org/projects/calendarserver/changeset/5112
Author: sagen at apple.com
Date: 2010-02-13 11:24:59 -0800 (Sat, 13 Feb 2010)
Log Message:
-----------
Hooking up autoSchedule in calendarserver_manage_principals, plus test
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/principals.py
CalendarServer/trunk/calendarserver/tools/test/test_principals.py
Modified: CalendarServer/trunk/calendarserver/tools/principals.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/principals.py 2010-02-13 17:40:36 UTC (rev 5111)
+++ CalendarServer/trunk/calendarserver/tools/principals.py 2010-02-13 19:24:59 UTC (rev 5112)
@@ -35,6 +35,7 @@
from twistedcaldav.config import config, ConfigurationError
from twistedcaldav.directory.directory import UnknownRecordTypeError, DirectoryError
+from twistedcaldav.directory import augment
from calendarserver.tools.util import loadConfig, getDirectory, setupMemcached, setupNotifications, booleanArgument
@@ -453,7 +454,6 @@
(yield subPrincipal.writeProperty(membersProperty, None))
-
@inlineCallbacks
def action_setAutoSchedule(principal, autoSchedule):
if autoSchedule and principal.record.recordType in ("users", "groups"):
@@ -464,8 +464,17 @@
principal,
)
principal.setAutoSchedule(autoSchedule)
+ record = principal.record
+ aug = (yield augment.AugmentService.getAugmentRecord(record.guid))
+ aug.autoSchedule = autoSchedule
- at inlineCallbacks
+ # FIXME: This doesn't seem like a good idea, but I don't see a way
+ # to know whether there is already a record there, so I'm currently
+ # removing the record before adding it.
+ (yield augment.AugmentService.removeAugmentRecords([record.guid]))
+
+ (yield augment.AugmentService.addAugmentRecords([aug], update=False))
+
def action_getAutoSchedule(principal):
autoSchedule = principal.getAutoSchedule()
print "Autoschedule for %s is %s" % (
Modified: CalendarServer/trunk/calendarserver/tools/test/test_principals.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/test_principals.py 2010-02-13 17:40:36 UTC (rev 5111)
+++ CalendarServer/trunk/calendarserver/tools/test/test_principals.py 2010-02-13 19:24:59 UTC (rev 5112)
@@ -132,3 +132,18 @@
results = yield self.runCommand("--list-read-proxies",
"locations:location01")
self.assertTrue("No read proxies for (locations)location01" in results)
+
+
+ @inlineCallbacks
+ def test_autoSchedule(self):
+ results = yield self.runCommand("--get-auto-schedule",
+ "locations:location01")
+ self.assertTrue(results.startswith("Autoschedule for (locations)location01 is false"))
+
+ results = yield self.runCommand("--set-auto-schedule=true",
+ "locations:location01")
+ self.assertTrue(results.startswith("Setting auto-schedule to true for (locations)location01"))
+
+ results = yield self.runCommand("--get-auto-schedule",
+ "locations:location01")
+ self.assertTrue(results.startswith("Autoschedule for (locations)location01 is true"))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100213/18ebb780/attachment.html>
More information about the calendarserver-changes
mailing list