[CalendarServer-changes] [5993] CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore

source_changes at macosforge.org source_changes at macosforge.org
Thu Aug 5 20:33:03 PDT 2010


Revision: 5993
          http://trac.macosforge.org/projects/calendarserver/changeset/5993
Author:   glyph at apple.com
Date:     2010-08-05 20:33:00 -0700 (Thu, 05 Aug 2010)
Log Message:
-----------
stub attachment

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/file.py
    CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/postgres.py

Modified: CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/file.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/file.py	2010-08-06 00:27:51 UTC (rev 5992)
+++ CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/file.py	2010-08-06 03:33:00 UTC (rev 5993)
@@ -14,8 +14,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 ##
-from txcaldav.calendarstore.util import validateCalendarComponent,\
-    dropboxIDFromCalendarObject
 
 """
 File calendar store.
@@ -35,6 +33,7 @@
 
 from twisted.internet.interfaces import ITransport
 from twisted.python.failure import Failure
+
 from txdav.propertystore.xattr import PropertyStore
 
 from twext.python.vcomponent import InvalidICalendarDataError
@@ -43,7 +42,6 @@
 from twext.web2.dav.resource import TwistedGETContentMD5
 from twext.web2.http_headers import generateContentType
 
-
 from twistedcaldav import caldavxml, customxml
 from twistedcaldav.caldavxml import ScheduleCalendarTransp, Opaque
 from twistedcaldav.index import Index as OldIndex, IndexSchedule as OldInboxIndex
@@ -53,9 +51,15 @@
 from txcaldav.icalendarstore import ICalendar, ICalendarObject
 from txcaldav.icalendarstore import ICalendarHome
 
+from txcaldav.calendarstore.util import (
+    validateCalendarComponent, dropboxIDFromCalendarObject
+)
 
-from txdav.common.datastore.file import (CommonDataStore, 
-    CommonStoreTransaction, CommonHome, CommonHomeChild, CommonObjectResource)
+from txdav.common.datastore.file import (
+    CommonDataStore, CommonStoreTransaction, CommonHome, CommonHomeChild,
+    CommonObjectResource
+)
+
 from txdav.common.icommondatastore import (NoSuchObjectResourceError,
     InternalDataStoreError)
 from txdav.datastore.file import writeOperation, hidden, FileMetaDataMixin
@@ -427,6 +431,7 @@
         props.flush()
 
 
+
 class Attachment(FileMetaDataMixin):
     """
     An L{Attachment} is a container for the data associated with a I{locally-

Modified: CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/postgres.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/postgres.py	2010-08-06 00:27:51 UTC (rev 5992)
+++ CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/postgres.py	2010-08-06 03:33:00 UTC (rev 5993)
@@ -14,6 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 ##
+from twisted.internet.interfaces import ITransport
 
 """
 PostgreSQL data store.
@@ -42,7 +43,7 @@
 
 
 from txcaldav.icalendarstore import (ICalendarTransaction, ICalendarHome,
-    ICalendar, ICalendarObject)
+    ICalendar, ICalendarObject, IAttachment)
 from txdav.propertystore.base import AbstractPropertyStore, PropertyName
 from txdav.propertystore.none import PropertyStore
 
@@ -246,7 +247,8 @@
 
 
     def createAttachmentWithName(self, name, contentType):
-        pass
+        attachment = PostgresAttachment(self, name)
+        return attachment.store(contentType)
 
 
     def attachments(self):
@@ -284,6 +286,37 @@
         return None
 
 
+
+class PostgresAttachment(object):
+    
+    implements(IAttachment)
+
+    def __init__(self, calendarObject, name):
+        self._calendarObject = calendarObject
+        self._name = name
+
+
+    def store(self, contentType):
+        return PostgresAttachmentStorageTransport(self, contentType)
+
+
+
+class PostgresAttachmentStorageTransport(object):
+
+    implements(ITransport)
+    
+    def __init__(self, attachment, contentType):
+        self.attachment = attachment
+        self.contentType = contentType
+
+    def write(self, data):
+        pass
+
+    def loseConnection(self):
+        pass
+
+
+
 class PostgresCalendar(object):
 
     implements(ICalendar)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100805/c8dd6bc5/attachment-0001.html>


More information about the calendarserver-changes mailing list