[CalendarServer-changes] [6954] CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/ sql.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Feb 16 06:30:09 PST 2011
Revision: 6954
http://trac.macosforge.org/projects/calendarserver/changeset/6954
Author: glyph at apple.com
Date: 2011-02-16 06:30:09 -0800 (Wed, 16 Feb 2011)
Log Message:
-----------
dalify quotaUsedBytes
Modified Paths:
--------------
CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql.py
Modified: CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql.py 2011-02-16 14:29:57 UTC (rev 6953)
+++ CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql.py 2011-02-16 14:30:09 UTC (rev 6954)
@@ -818,16 +818,20 @@
returnValue(results)
+ @classproperty
+ def _quotaQuery(cls):
+ meta = cls._homeMetaDataSchema
+ return Select(
+ [meta.QUOTA_USED_BYTES], From=meta,
+ Where=meta.RESOURCE_ID == Parameter("resourceID")
+ )
+
+
@inlineCallbacks
def quotaUsedBytes(self):
-
if self._quotaUsedBytes is None:
- self._quotaUsedBytes = (yield self._txn.execSQL(
- "select %(column_QUOTA_USED_BYTES)s from %(name)s"
- " where %(column_RESOURCE_ID)s = %%s" % self._homeMetaDataTable,
- [self._resourceID]
- ))[0][0]
-
+ self._quotaUsedBytes = (yield self._quotaQuery.on(
+ self._txn, resourceID=self._resourceID))[0][0]
returnValue(self._quotaUsedBytes)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110216/ad0959dc/attachment.html>
More information about the calendarserver-changes
mailing list