[CalendarServer-changes] [1565] CalendarServer/trunk/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Wed May 23 14:55:30 PDT 2007


Revision: 1565
          http://trac.macosforge.org/projects/calendarserver/changeset/1565
Author:   wsanchez at apple.com
Date:     2007-05-23 14:55:30 -0700 (Wed, 23 May 2007)

Log Message:
-----------
Get rid of some class variables that are copies of data from the config object.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/config.py
    CalendarServer/trunk/twistedcaldav/directory/calendar.py
    CalendarServer/trunk/twistedcaldav/method/put_common.py
    CalendarServer/trunk/twistedcaldav/resource.py

Modified: CalendarServer/trunk/twistedcaldav/config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/config.py	2007-05-23 20:40:39 UTC (rev 1564)
+++ CalendarServer/trunk/twistedcaldav/config.py	2007-05-23 21:55:30 UTC (rev 1565)
@@ -222,17 +222,10 @@
         EnableDropBox
         EnableNotifications
         """
-        
         from twistedcaldav.resource import CalendarPrincipalResource
         CalendarPrincipalResource.enableDropBox(self.EnableDropBox)
         CalendarPrincipalResource.enableNotifications(self.EnableNotifications)
 
-        # Handle global quota value
-        from twistedcaldav.directory.calendar import DirectoryCalendarHomeResource
-        from twistedcaldav.resource import CalDAVResource
-        DirectoryCalendarHomeResource.quotaLimit = self.UserQuota
-        CalDAVResource.sizeLimit = self.MaximumAttachmentSize
-
     def updateDefaults(self, items):
         _mergeData(self._defaults, items)
         self.update(items)

Modified: CalendarServer/trunk/twistedcaldav/directory/calendar.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/calendar.py	2007-05-23 20:40:39 UTC (rev 1564)
+++ CalendarServer/trunk/twistedcaldav/directory/calendar.py	2007-05-23 21:55:30 UTC (rev 1565)
@@ -174,10 +174,6 @@
     """
     Calendar home collection resource.
     """
-    # A global quota limit for all calendar homes. Either a C{int} (size in bytes) to limit
-    # quota to that size, or C{None} for no limit.
-    quotaLimit = None
-
     def __init__(self, parent, record):
         """
         @param path: the path to the file which will back the resource.
@@ -309,7 +305,7 @@
         """
         @return: a C{True} if this resource has quota root, C{False} otherwise.
         """
-        return self.hasDeadProperty(TwistedQuotaRootProperty) or DirectoryCalendarHomeResource.quotaLimit is not None
+        return self.hasDeadProperty(TwistedQuotaRootProperty) or config.UserQuota
     
     def quotaRoot(self, request):
         """
@@ -319,7 +315,7 @@
         if self.hasDeadProperty(TwistedQuotaRootProperty):
             return int(str(self.readDeadProperty(TwistedQuotaRootProperty)))
         else:
-            return DirectoryCalendarHomeResource.quotaLimit
+            return config.UserQuota
 
 ##
 # Utilities

Modified: CalendarServer/trunk/twistedcaldav/method/put_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/put_common.py	2007-05-23 20:40:39 UTC (rev 1564)
+++ CalendarServer/trunk/twistedcaldav/method/put_common.py	2007-05-23 21:55:30 UTC (rev 1565)
@@ -41,6 +41,7 @@
 from twisted.web2.stream import MemoryStream
 
 from twistedcaldav import logging
+from twistedcaldav.config import config
 from twistedcaldav.caldavxml import NoUIDConflict
 from twistedcaldav.caldavxml import NumberOfRecurrencesWithinLimits
 from twistedcaldav.caldavxml import caldav_namespace
@@ -236,11 +237,11 @@
         """
         result = True
         message = ""
-        if CalDAVResource.sizeLimit is not None:
+        if config.MaximumAttachmentSize:
             calsize = len(str(calendar))
-            if calsize > CalDAVResource.sizeLimit:
+            if calsize > config.MaximumAttachmentSize:
                 result = False
-                message = "Data size %d bytes is larger than allowed limit %d bytes" % (calsize, CalDAVResource.sizeLimit)
+                message = "Data size %d bytes is larger than allowed limit %d bytes" % (calsize, config.MaximumAttachmentSize)
 
         return result, message
 

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2007-05-23 20:40:39 UTC (rev 1564)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2007-05-23 21:55:30 UTC (rev 1565)
@@ -74,10 +74,6 @@
     """
     implements(ICalDAVResource)
 
-    # A global limit for the size of calendar object resources. Either a C{int} (size in bytes) to limit
-    # resources to that size, or C{None} for no limit.
-    sizeLimit = None
-
     ##
     # HTTP
     ##
@@ -169,9 +165,9 @@
                 ))
             elif name == "max-resource-size":
                 # CalDAV-access-15, section 5.2.5
-                if CalDAVResource.sizeLimit is not None:
+                if config.MaximumAttachmentSize:
                     return succeed(caldavxml.MaxResourceSize.fromString(
-                        str(CalDAVResource.sizeLimit)
+                        str(config.MaximumAttachmentSize)
                     ))
 
         return super(CalDAVResource, self).readProperty(property, request)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070523/612c3839/attachment.html


More information about the calendarserver-changes mailing list