[CalendarServer-changes] [14809] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Wed May 20 01:39:48 PDT 2015
Revision: 14809
http://trac.calendarserver.org//changeset/14809
Author: cdaboo at apple.com
Date: 2015-05-20 01:39:48 -0700 (Wed, 20 May 2015)
Log Message:
-----------
Make sure task-only calendars are ignored during freebusy checks.
Modified Paths:
--------------
CalendarServer/trunk/requirements-stable.txt
CalendarServer/trunk/twistedcaldav/scheduling_store/caldav/test/test_resource.py
CalendarServer/trunk/txdav/caldav/datastore/sql.py
CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py
Modified: CalendarServer/trunk/requirements-stable.txt
===================================================================
--- CalendarServer/trunk/requirements-stable.txt 2015-05-20 08:37:18 UTC (rev 14808)
+++ CalendarServer/trunk/requirements-stable.txt 2015-05-20 08:39:48 UTC (rev 14809)
@@ -36,7 +36,7 @@
#pyOpenSSL
pycrypto==2.6.1
- --editable svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk@14786#egg=twextpy
+ --editable svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk@14808#egg=twextpy
cffi==0.8.6
pycparser==2.10
#twisted
Modified: CalendarServer/trunk/twistedcaldav/scheduling_store/caldav/test/test_resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling_store/caldav/test/test_resource.py 2015-05-20 08:37:18 UTC (rev 14808)
+++ CalendarServer/trunk/twistedcaldav/scheduling_store/caldav/test/test_resource.py 2015-05-20 08:39:48 UTC (rev 14809)
@@ -103,6 +103,40 @@
@inlineCallbacks
+ def test_free_busy_set_tasks(self):
+ """
+ Test that calendar-free-busy-set ignores tasks calendar.
+ """
+
+ request = SimpleRequest(self.site, "GET", "/calendars/users/user01/inbox/")
+ inbox = yield request.locateResource("/calendars/users/user01/inbox/")
+ self.assertTrue((yield inbox.hasProperty(caldavxml.CalendarFreeBusySet, request)))
+ prop = (yield inbox.readProperty(caldavxml.CalendarFreeBusySet, request))
+ self.assertEqual(
+ set([str(child) for child in prop.children]),
+ set((
+ "/calendars/__uids__/user01/calendar/",
+ ))
+ )
+ newfbset = set()
+ newfbset.add("/calendars/users/user01/tasks/")
+ newset = caldavxml.CalendarFreeBusySet(*[davxml.HRef(url) for url in newfbset])
+
+ yield inbox.writeProperty(newset, request)
+ yield request._newStoreTransaction.commit()
+
+ request = SimpleRequest(self.site, "GET", "/calendars/users/user01/inbox/")
+ inbox = yield request.locateResource("/calendars/users/user01/inbox/")
+ prop = (yield inbox.readProperty(caldavxml.CalendarFreeBusySet, request))
+ self.assertEqual(len(prop.children), 0)
+ yield request._newStoreTransaction.commit()
+ calendar = yield request.locateResource("/calendars/__uids__/user01/tasks/")
+ self.assertFalse(calendar._newStoreObject.isUsedForFreeBusy())
+ calendar = yield request.locateResource("/calendars/__uids__/user01/calendar/")
+ self.assertFalse(calendar._newStoreObject.isUsedForFreeBusy())
+
+
+ @inlineCallbacks
def test_free_busy_set_invalid_url(self):
"""
Test that calendar-free-busy-set will generate an error if an invalid value is used.
Modified: CalendarServer/trunk/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/sql.py 2015-05-20 08:37:18 UTC (rev 14808)
+++ CalendarServer/trunk/txdav/caldav/datastore/sql.py 2015-05-20 08:39:48 UTC (rev 14809)
@@ -1590,12 +1590,13 @@
def isUsedForFreeBusy(self):
"""
Indicates whether the contents of this calendar contributes to free busy. Always coerce
- inbox to be transparent.
+ inbox to be transparent. Also ignore VTODO only calendars.
@return: C{True} if it does, C{False} otherwise
@rtype: C{bool}
"""
- return (self._transp == _TRANSP_OPAQUE) and not self.isInbox() and not self.isTrash()
+ supported = not self._supportedComponents or self._supportedComponents.split(",") != ["VTODO", ]
+ return (self._transp == _TRANSP_OPAQUE) and not self.isInbox() and not self.isTrash() and supported
@inlineCallbacks
Modified: CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py 2015-05-20 08:37:18 UTC (rev 14808)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py 2015-05-20 08:39:48 UTC (rev 14809)
@@ -2053,6 +2053,36 @@
@inlineCallbacks
+ def test_tasksTransp(self):
+ """
+ Make sure tasks is always transparent no matter what is stored in the DB.
+ """
+
+ home = yield self.homeUnderTest(name="user01", create=True)
+ self.assertNotEqual(home, None)
+ tasks = yield self.calendarUnderTest(home="user01", name="tasks")
+ self.assertFalse(tasks.isUsedForFreeBusy())
+ yield tasks.setUsedForFreeBusy(True)
+ self.assertFalse(tasks.isUsedForFreeBusy())
+ yield self.commit()
+
+ tasks = yield self.calendarUnderTest(home="user01", name="tasks")
+ self.assertFalse(tasks.isUsedForFreeBusy())
+
+ cb = schema.CALENDAR_BIND
+ yield Update(
+ {cb.TRANSP: _TRANSP_OPAQUE},
+ Where=(cb.CALENDAR_RESOURCE_NAME == "tasks").And(
+ cb.CALENDAR_RESOURCE_ID == tasks.id()
+ )
+ ).on(self.transactionUnderTest())
+ yield self.commit()
+
+ tasks = yield self.calendarUnderTest(home="user01", name="tasks")
+ self.assertFalse(tasks.isUsedForFreeBusy())
+
+
+ @inlineCallbacks
def test_missingTimezone(self):
"""
Make sure missing timezone causes an exception, whether or timezones by reference is on.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150520/c9e08245/attachment-0001.html>
More information about the calendarserver-changes
mailing list