[CalendarServer-changes] [6795] CalendarServer/trunk/txdav

source_changes at macosforge.org source_changes at macosforge.org
Thu Jan 20 09:55:08 PST 2011


Revision: 6795
          http://trac.macosforge.org/projects/calendarserver/changeset/6795
Author:   cdaboo at apple.com
Date:     2011-01-20 09:55:07 -0800 (Thu, 20 Jan 2011)
Log Message:
-----------
Fix some filestore bugs.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/caldav/datastore/file.py
    CalendarServer/trunk/txdav/carddav/datastore/file.py

Modified: CalendarServer/trunk/txdav/caldav/datastore/file.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/file.py	2011-01-20 14:31:20 UTC (rev 6794)
+++ CalendarServer/trunk/txdav/caldav/datastore/file.py	2011-01-20 17:55:07 UTC (rev 6795)
@@ -42,7 +42,7 @@
 from twext.web2.dav import davxml
 from twext.web2.dav.element.rfc2518 import ResourceType, GETContentType
 from twext.web2.dav.resource import TwistedGETContentMD5
-from twext.web2.http_headers import generateContentType
+from twext.web2.http_headers import generateContentType, MimeType
 
 from twistedcaldav import caldavxml, customxml
 from twistedcaldav.caldavxml import ScheduleCalendarTransp, Opaque
@@ -252,8 +252,14 @@
             ),
         )
 
+    def contentType(self):
+        """
+        The content type of Calendar objects is text/calendar.
+        """
+        return MimeType.fromString("text/calendar; charset=utf-8")
 
 
+
 class CalendarObject(CommonObjectResource):
     """
     @ivar _path: The path of the .ics file on disk
@@ -266,13 +272,12 @@
         super(CalendarObject, self).__init__(name, calendar)
         self._attachments = {}
         
-        if metadata is None:
-            metadata = {}
-        self.accessMode = metadata.get("accessMode", "")
-        self.isScheduleObject = metadata.get("isScheduleObject", False)
-        self.scheduleTag = metadata.get("scheduleTag", "")
-        self.scheduleEtags = metadata.get("scheduleEtags", "")
-        self.hasPrivateComment = metadata.get("hasPrivateComment", False)
+        if metadata is not None:
+            self.accessMode = metadata.get("accessMode", "")
+            self.isScheduleObject = metadata.get("isScheduleObject", False)
+            self.scheduleTag = metadata.get("scheduleTag", "")
+            self.scheduleEtags = metadata.get("scheduleEtags", "")
+            self.hasPrivateComment = metadata.get("hasPrivateComment", False)
 
 
     @property
@@ -516,7 +521,6 @@
             returnValue(None)
 
 
-    @inlineCallbacks
     def attendeesCanManageAttachments(self):
         return self.component().hasPropertyInAnyComponent("X-APPLE-DROPBOX")
 
@@ -563,8 +567,15 @@
             ),
         )
 
+    # IDataStoreResource
+    def contentType(self):
+        """
+        The content type of Calendar objects is text/calendar.
+        """
+        return MimeType.fromString("text/calendar; charset=utf-8")
 
 
+
 class AttachmentStorageTransport(object):
 
     implements(ITransport)

Modified: CalendarServer/trunk/txdav/carddav/datastore/file.py
===================================================================
--- CalendarServer/trunk/txdav/carddav/datastore/file.py	2011-01-20 14:31:20 UTC (rev 6794)
+++ CalendarServer/trunk/txdav/carddav/datastore/file.py	2011-01-20 17:55:07 UTC (rev 6795)
@@ -31,6 +31,7 @@
 
 from twext.web2.dav.element.rfc2518 import ResourceType, GETContentType
 from twext.web2.dav.resource import TwistedGETContentMD5
+from twext.web2.http_headers import MimeType
 
 from twisted.python import hashlib
 
@@ -146,6 +147,11 @@
     def _doValidate(self, component):
         component.validForCardDAV()
 
+    def contentType(self):
+        """
+        The content type of Addresbook objects is text/vcard.
+        """
+        return MimeType.fromString("text/vcard; charset=utf-8")
 
 class AddressBookObject(CommonObjectResource):
     """
@@ -269,6 +275,12 @@
             self._uid = self.component().resourceUID()
         return self._uid
 
+    # IDataStoreResource
+    def contentType(self):
+        """
+        The content type of Addressbook objects is text/x-vcard.
+        """
+        return MimeType.fromString("text/vcard; charset=utf-8")
 
 class AddressBookStubResource(CommonStubResource):
     """
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110120/8403c3a3/attachment.html>


More information about the calendarserver-changes mailing list