[CalendarServer-changes] [5834] CalendarServer/branches/new-store/txcaldav/calendarstore
source_changes at macosforge.org
source_changes at macosforge.org
Thu Jul 1 16:57:05 PDT 2010
Revision: 5834
http://trac.macosforge.org/projects/calendarserver/changeset/5834
Author: glyph at apple.com
Date: 2010-07-01 16:57:05 -0700 (Thu, 01 Jul 2010)
Log Message:
-----------
'dropbox' should never show up as a calendar
Modified Paths:
--------------
CalendarServer/branches/new-store/txcaldav/calendarstore/file.py
CalendarServer/branches/new-store/txcaldav/calendarstore/test/common.py
Modified: CalendarServer/branches/new-store/txcaldav/calendarstore/file.py
===================================================================
--- CalendarServer/branches/new-store/txcaldav/calendarstore/file.py 2010-07-01 22:12:06 UTC (rev 5833)
+++ CalendarServer/branches/new-store/txcaldav/calendarstore/file.py 2010-07-01 23:57:05 UTC (rev 5834)
@@ -82,9 +82,14 @@
createCalendarWithName = CommonHome.createChildWithName
removeCalendarWithName = CommonHome.removeChildWithName
- calendars = CommonHome.children
+ def calendars(self):
+ for child in self.children():
+ if child.name() == 'dropbox':
+ continue
+ yield child
+
def calendarObjectWithDropboxID(self, dropboxID):
"""
Implement lookup with brute-force scanning.
@@ -99,6 +104,7 @@
def _calendarStore(self):
return self._dataStore
+
def created(self):
self.createCalendarWithName("calendar")
defaultCal = self.calendarWithName("calendar")
@@ -107,6 +113,8 @@
Opaque())
self.createCalendarWithName("inbox")
+
+
class Calendar(CommonHomeChild):
"""
File-based implementation of L{ICalendar}.
@@ -135,13 +143,16 @@
self._invites = Invites(self)
self._objectResourceClass = CalendarObject
+
@property
def _calendarHome(self):
return self._home
+
def resourceType(self):
return ResourceType.calendar
+
ownerCalendarHome = CommonHomeChild.ownerHome
calendarObjects = CommonHomeChild.objectResources
calendarObjectWithName = CommonHomeChild.objectResourceWithName
@@ -164,6 +175,7 @@
component.validateForCalDAV()
+
class CalendarObject(CommonObjectResource):
"""
@ivar _path: The path of the .ics file on disk
@@ -176,10 +188,12 @@
super(CalendarObject, self).__init__(name, calendar)
self._attachments = {}
+
@property
def _calendar(self):
return self._parentCollection
+
@writeOperation
def setComponent(self, component):
if not isinstance(component, VComponent):
@@ -323,12 +337,19 @@
# But, ahem.
+ def _allSubcomponents(self, component):
+ for subcomponent in component.subcomponents():
+ yield subcomponent
+ for deeper in self._allSubcomponents(subcomponent):
+ yield deeper
+
+
def dropboxID(self):
"""
"""
component = self.component()
- for subcomp in component.subcomponents():
+ for subcomp in self._allSubcomponents(component):
dropboxProperty = subcomp.getProperty("X-APPLE-DROPBOX")
if dropboxProperty is not None:
componentDropboxID = dropboxProperty.value().split("/")[-1]
Modified: CalendarServer/branches/new-store/txcaldav/calendarstore/test/common.py
===================================================================
--- CalendarServer/branches/new-store/txcaldav/calendarstore/test/common.py 2010-07-01 22:12:06 UTC (rev 5833)
+++ CalendarServer/branches/new-store/txcaldav/calendarstore/test/common.py 2010-07-01 23:57:05 UTC (rev 5834)
@@ -966,7 +966,7 @@
"""
L{ICalendarObject.createAttachmentWithName} may create a directory
named 'dropbox', but this should not be seen as a calendar by
- L{ICalendarHome.calendarWithName}.
+ L{ICalendarHome.calendarWithName} or L{ICalendarHome.calendars}.
"""
obj = self.calendarObjectUnderTest()
t = obj.createAttachmentWithName("new.attachment", "text/plain")
@@ -975,5 +975,8 @@
self.commit()
self.assertEquals(self.homeUnderTest().calendarWithName("dropbox"),
None)
+ self.assertEquals(
+ set([n.name() for n in self.homeUnderTest().calendars()]),
+ set(home1_calendarNames))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100701/fa4bbbdb/attachment.html>
More information about the calendarserver-changes
mailing list