[CalendarServer-changes] [6839] CalendarServer/trunk/txdav/caldav/datastore/sql.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Feb 1 10:16:26 PST 2011


Revision: 6839
          http://trac.macosforge.org/projects/calendarserver/changeset/6839
Author:   cdaboo at apple.com
Date:     2011-02-01 10:16:24 -0800 (Tue, 01 Feb 2011)
Log Message:
-----------
Add new attachment api to make it easier to work with them without a calendar object.

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

Modified: CalendarServer/trunk/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/sql.py	2011-02-01 18:10:18 UTC (rev 6838)
+++ CalendarServer/trunk/txdav/caldav/datastore/sql.py	2011-02-01 18:16:24 UTC (rev 6839)
@@ -671,11 +671,8 @@
         attachment = (yield self.attachmentWithName(name))
         yield attachment.remove()
 
-    @inlineCallbacks
     def attachmentWithName(self, name):
-        attachment = Attachment(self._txn, self._dropboxID, name)
-        attachment = (yield attachment.initFromStore())
-        returnValue(attachment)
+        return Attachment.attachmentWithName(self._txn, self._dropboxID, name)
 
     def attendeesCanManageAttachments(self):
         return self._attachment == _ATTACHMENTS_MODE_WRITE
@@ -826,7 +823,14 @@
         )
         returnValue(attachment)
 
+    @classmethod
     @inlineCallbacks
+    def attachmentWithName(cls, txn, dropboxID, name):
+        attachment = Attachment(txn, dropboxID, name)
+        attachment = (yield attachment.initFromStore())
+        returnValue(attachment)
+
+    @inlineCallbacks
     def initFromStore(self):
         """
         Execute necessary SQL queries to retrieve attributes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110201/c89fd2e5/attachment.html>


More information about the calendarserver-changes mailing list