[CalendarServer-changes] [6944] CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/ sql.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Feb 16 06:28:08 PST 2011
Revision: 6944
http://trac.macosforge.org/projects/calendarserver/changeset/6944
Author: glyph at apple.com
Date: 2011-02-16 06:28:07 -0800 (Wed, 16 Feb 2011)
Log Message:
-----------
dalify attachment load
Modified Paths:
--------------
CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/sql.py
Modified: CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/sql.py 2011-02-16 14:27:57 UTC (rev 6943)
+++ CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/sql.py 2011-02-16 14:28:07 UTC (rev 6944)
@@ -789,14 +789,12 @@
@return: C{True} if this attachment exists, C{False} otherwise.
"""
- rows = yield self._txn.execSQL(
- """
- select CALENDAR_HOME_RESOURCE_ID, CONTENT_TYPE, SIZE, MD5, CREATED, MODIFIED
- from ATTACHMENT
- where DROPBOX_ID = %s and PATH = %s
- """,
- [self._dropboxID, self._name]
- )
+ att = schema.ATTACHMENT
+ rows = (yield Select([att.CALENDAR_HOME_RESOURCE_ID, att.CONTENT_TYPE,
+ att.SIZE, att.MD5, att.CREATED, att.MODIFIED],
+ From=att,
+ Where=(att.DROPBOX_ID == self._dropboxID).And(
+ att.PATH == self._name)).on(self._txn))
if not rows:
returnValue(None)
self._ownerHomeID = rows[0][0]
@@ -811,14 +809,16 @@
def name(self):
return self._name
+
@property
def _path(self):
attachmentRoot = self._txn._store.attachmentsPath
-
# Use directory hashing scheme based on MD5 of dropboxID
hasheduid = hashlib.md5(self._dropboxID).hexdigest()
- return attachmentRoot.child(hasheduid[0:2]).child(hasheduid[2:4]).child(hasheduid).child(self.name())
+ return attachmentRoot.child(hasheduid[0:2]).child(
+ hasheduid[2:4]).child(hasheduid).child(self.name())
+
def properties(self):
pass # stub
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110216/cf930efd/attachment.html>
More information about the calendarserver-changes
mailing list