[CalendarServer-changes] [6935] CalendarServer/branches/users/glyph/dalify/txdav/caldav
source_changes at macosforge.org
source_changes at macosforge.org
Wed Feb 16 06:26:29 PST 2011
Revision: 6935
http://trac.macosforge.org/projects/calendarserver/changeset/6935
Author: glyph at apple.com
Date: 2011-02-16 06:26:28 -0800 (Wed, 16 Feb 2011)
Log Message:
-----------
Document and test getAllDropboxIDs and make it consistent.
Modified Paths:
--------------
CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/file.py
CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/test/common.py
CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/test/test_sql.py
CalendarServer/branches/users/glyph/dalify/txdav/caldav/icalendarstore.py
Modified: CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/file.py
===================================================================
--- CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/file.py 2011-02-16 14:26:16 UTC (rev 6934)
+++ CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/file.py 2011-02-16 14:26:28 UTC (rev 6935)
@@ -164,15 +164,17 @@
@inlineCallbacks
def getAllDropboxIDs(self):
-
dropboxIDs = []
for calendar in self.calendars():
for calendarObject in calendar.calendarObjects():
- dropboxID = (yield calendarObject.dropboxID())
- dropboxIDs.append(dropboxID)
-
+ component = calendarObject.component()
+ if (component.hasPropertyInAnyComponent("X-APPLE-DROPBOX") or
+ component.hasPropertyInAnyComponent("ATTACH")):
+ dropboxID = (yield calendarObject.dropboxID())
+ dropboxIDs.append(dropboxID)
returnValue(dropboxIDs)
+
@property
def _calendarStore(self):
return self._dataStore
Modified: CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/test/common.py
===================================================================
--- CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/test/common.py 2011-02-16 14:26:16 UTC (rev 6934)
+++ CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/test/common.py 2011-02-16 14:26:28 UTC (rev 6935)
@@ -1229,6 +1229,22 @@
@inlineCallbacks
+ def test_dropboxIDs(self):
+ """
+ L{ICalendarObject.getAllDropboxIDs} returns a L{Deferred} that fires
+ with a C{list} of all Dropbox IDs.
+ """
+ home = yield self.homeUnderTest()
+ # The only item in the home which has an ATTACH or X-APPLE-DROPBOX
+ # property.
+ allDropboxIDs = set([
+ u'FE5CDC6F-7776-4607-83A9-B90FF7ACC8D0.dropbox',
+ ])
+ self.assertEquals(set((yield home.getAllDropboxIDs())),
+ allDropboxIDs)
+
+
+ @inlineCallbacks
def test_indexByDropboxProperty(self):
"""
L{ICalendarHome.calendarObjectWithDropboxID} will return a calendar
Modified: CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/test/test_sql.py 2011-02-16 14:26:16 UTC (rev 6934)
+++ CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/test/test_sql.py 2011-02-16 14:26:28 UTC (rev 6935)
@@ -130,7 +130,9 @@
)._txn._store.attachmentsPath
obj = yield self.calendarObjectUnderTest()
hasheduid = hashlib.md5(obj._dropboxID).hexdigest()
- attachmentPath = attachmentRoot.child(hasheduid[0:2]).child(hasheduid[2:4]).child(hasheduid).child("new.attachment")
+ attachmentPath = attachmentRoot.child(
+ hasheduid[0:2]).child(hasheduid[2:4]).child(hasheduid).child(
+ "new.attachment")
self.assertTrue(attachmentPath.isfile())
Modified: CalendarServer/branches/users/glyph/dalify/txdav/caldav/icalendarstore.py
===================================================================
--- CalendarServer/branches/users/glyph/dalify/txdav/caldav/icalendarstore.py 2011-02-16 14:26:16 UTC (rev 6934)
+++ CalendarServer/branches/users/glyph/dalify/txdav/caldav/icalendarstore.py 2011-02-16 14:26:28 UTC (rev 6935)
@@ -162,6 +162,18 @@
"""
+ def getAllDropboxIDs():
+ """
+ Retrieve all of the dropbox IDs of events in this home for calendar
+ objects which either allow attendee write access to their dropboxes,
+ have attachments to read, or both.
+
+ @return: a L{Deferred} which fires with a C{list} of all dropbox IDs (as
+ unicode strings)
+ """
+
+
+
class ICalendar(INotifier, IShareableCollection, IDataStoreResource):
"""
Calendar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110216/e2968b20/attachment-0001.html>
More information about the calendarserver-changes
mailing list