[CalendarServer-changes] [7724] CalendarServer/branches/users/glyph/disable-quota/txdav/caldav/ datastore
source_changes at macosforge.org
source_changes at macosforge.org
Thu Jul 7 02:35:10 PDT 2011
Revision: 7724
http://trac.macosforge.org/projects/calendarserver/changeset/7724
Author: glyph at apple.com
Date: 2011-07-07 02:35:10 -0700 (Thu, 07 Jul 2011)
Log Message:
-----------
allow quota to be unlimited (and test for it, although the test is somewhat simplistic, as it's hard to test infinite quota usage)
Modified Paths:
--------------
CalendarServer/branches/users/glyph/disable-quota/txdav/caldav/datastore/file.py
CalendarServer/branches/users/glyph/disable-quota/txdav/caldav/datastore/sql.py
CalendarServer/branches/users/glyph/disable-quota/txdav/caldav/datastore/test/common.py
Modified: CalendarServer/branches/users/glyph/disable-quota/txdav/caldav/datastore/file.py
===================================================================
--- CalendarServer/branches/users/glyph/disable-quota/txdav/caldav/datastore/file.py 2011-07-07 09:34:58 UTC (rev 7723)
+++ CalendarServer/branches/users/glyph/disable-quota/txdav/caldav/datastore/file.py 2011-07-07 09:35:10 UTC (rev 7724)
@@ -621,9 +621,9 @@
newSize = self._file.tell()
# FIXME: do anything
self._file.close()
-
- if home.quotaAllowedBytes() < (home.quotaUsedBytes()
- + (newSize - oldSize)):
+ allowed = home.quotaAllowedBytes()
+ if allowed is not None and allowed < (home.quotaUsedBytes()
+ + (newSize - oldSize)):
self._path.remove()
return fail(QuotaExceeded())
Modified: CalendarServer/branches/users/glyph/disable-quota/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/glyph/disable-quota/txdav/caldav/datastore/sql.py 2011-07-07 09:34:58 UTC (rev 7723)
+++ CalendarServer/branches/users/glyph/disable-quota/txdav/caldav/datastore/sql.py 2011-07-07 09:35:10 UTC (rev 7724)
@@ -800,8 +800,9 @@
oldSize = self._attachment.size()
- if home.quotaAllowedBytes() < ((yield home.quotaUsedBytes())
- + (len(self._buf) - oldSize)):
+ allowed = home.quotaAllowedBytes()
+ if allowed is not None and allowed < ((yield home.quotaUsedBytes())
+ + (len(self._buf) - oldSize)):
if self._creating:
yield self._attachment._internalRemove()
raise QuotaExceeded()
Modified: CalendarServer/branches/users/glyph/disable-quota/txdav/caldav/datastore/test/common.py
===================================================================
--- CalendarServer/branches/users/glyph/disable-quota/txdav/caldav/datastore/test/common.py 2011-07-07 09:34:58 UTC (rev 7723)
+++ CalendarServer/branches/users/glyph/disable-quota/txdav/caldav/datastore/test/common.py 2011-07-07 09:35:10 UTC (rev 7724)
@@ -54,6 +54,7 @@
from txdav.caldav.icalendarstore import IAttachmentStorageTransport
from txdav.caldav.icalendarstore import QuotaExceeded
from txdav.common.datastore.test.util import deriveQuota
+from txdav.common.datastore.test.util import withSpecialQuota
from twistedcaldav.ical import Component
storePath = FilePath(__file__).parent().child("calendar_store")
@@ -1617,7 +1618,20 @@
self.assertEquals(expected, actual)
+ @withSpecialQuota(None)
@inlineCallbacks
+ def test_quotaUnlimited(self):
+ """
+ When L{ICalendarHome.quotaAllowedBytes} returns C{None}, quota is
+ unlimited; any sized attachment can be stored.
+ """
+ home = yield self.homeUnderTest()
+ allowed = home.quotaAllowedBytes()
+ self.assertIdentical(allowed, None)
+ yield self.test_createAttachment()
+
+
+ @inlineCallbacks
def test_quotaTransportAddress(self):
"""
Since L{IAttachmentStorageTransport} is a subinterface of L{ITransport},
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110707/497b0980/attachment.html>
More information about the calendarserver-changes
mailing list