[CalendarServer-changes] [186]
CalendarServer/branches/users/cdaboo/quota/lib-patches/Twisted
source_changes at macosforge.org
source_changes at macosforge.org
Fri Sep 22 11:13:38 PDT 2006
Revision: 186
http://trac.macosforge.org/projects/calendarserver/changeset/186
Author: cdaboo at apple.com
Date: 2006-09-22 11:13:38 -0700 (Fri, 22 Sep 2006)
Log Message:
-----------
Fix broken patches.
Modified Paths:
--------------
CalendarServer/branches/users/cdaboo/quota/lib-patches/Twisted/twisted.web2.dav.method.put_common.patch
Added Paths:
-----------
CalendarServer/branches/users/cdaboo/quota/lib-patches/Twisted/twisted.web2.dav.static.patch
Modified: CalendarServer/branches/users/cdaboo/quota/lib-patches/Twisted/twisted.web2.dav.method.put_common.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/quota/lib-patches/Twisted/twisted.web2.dav.method.put_common.patch 2006-09-22 18:10:36 UTC (rev 185)
+++ CalendarServer/branches/users/cdaboo/quota/lib-patches/Twisted/twisted.web2.dav.method.put_common.patch 2006-09-22 18:13:38 UTC (rev 186)
@@ -2,7 +2,7 @@
===================================================================
--- twisted/web2/dav/method/put_common.py (revision 0)
+++ twisted/web2/dav/method/put_common.py (revision 0)
-@@ -0,0 +1,228 @@
+@@ -0,0 +1,234 @@
+##
+# Copyright (c) 2005-2006 Apple Computer, Inc. All rights reserved.
+#
@@ -149,7 +149,9 @@
+ yield destquota
+ destquota = destquota.getResult()
+ if destquota is not None and destination.exists():
-+ old_dest_size = destination.quotaSize(request)
++ old_dest_size = waitForDeferred(destination.quotaSize(request))
++ yield old_dest_size
++ old_dest_size = old_dest_size.getResult()
+ else:
+ old_dest_size = 0
+
@@ -158,7 +160,9 @@
+ yield sourcequota
+ sourcequota = sourcequota.getResult()
+ if sourcequota is not None and source.exists():
-+ old_source_size = source.quotaSize(request)
++ old_source_size = waitForDeferred(source.quotaSize(request))
++ yield old_source_size
++ old_source_size = old_source_size.getResult()
+ else:
+ old_source_size = 0
+ else:
@@ -198,7 +202,9 @@
+ # Do quota check on destination
+ if destquota is not None:
+ # Get size of new/old resources
-+ new_dest_size = destination.quotaSize(request)
++ new_dest_size = waitForDeferred(destination.quotaSize(request))
++ yield new_dest_size
++ new_dest_size = new_dest_size.getResult()
+ diff_size = new_dest_size - old_dest_size
+ if diff_size >= destquota[0]:
+ log.err("Over quota: available %d, need %d" % (destquota[0], diff_size))
Copied: CalendarServer/branches/users/cdaboo/quota/lib-patches/Twisted/twisted.web2.dav.static.patch (from rev 180, CalendarServer/branches/users/cdaboo/quota/lib-patches/Twisted/twisted.web2.dav.static)
===================================================================
--- CalendarServer/branches/users/cdaboo/quota/lib-patches/Twisted/twisted.web2.dav.static.patch (rev 0)
+++ CalendarServer/branches/users/cdaboo/quota/lib-patches/Twisted/twisted.web2.dav.static.patch 2006-09-22 18:13:38 UTC (rev 186)
@@ -0,0 +1,55 @@
+Index: twisted/web2/dav/static.py
+===================================================================
+--- twisted/web2/dav/static.py (revision 18219)
++++ twisted/web2/dav/static.py (working copy)
+@@ -98,6 +98,50 @@
+ return succeed(davPrivilegeSet)
+
+ ##
++ # Quota
++ ##
++
++ def quotaSize(self, request):
++ """
++ Get the size of this resource.
++ TODO: Take into account size of dead-properties. Does stat
++ include xattrs size?
++
++ @return: an L{Deferred} with a C{int} result containing the size of the resource.
++ """
++ if self.isCollection():
++ def walktree(top):
++ """
++ Recursively descend the directory tree rooted at top,
++ calling the callback function for each regular file
++
++ @param top: L{FilePath} for the directory to walk.
++ """
++
++ total = 0
++ for f in top.listdir():
++ child = top.child(f)
++ if child.isdir():
++ # It's a directory, recurse into it
++ result = waitForDeferred(walktree(child))
++ yield result
++ total += result.getResult()
++ elif child.isfile():
++ # It's a file, call the callback function
++ total += child.getsize()
++ else:
++ # Unknown file type, print a message
++ pass
++
++ yield total
++
++ walktree = deferredGenerator(walktree)
++
++ return walktree(self.fp)
++ else:
++ return succeed(self.fp.getsize())
++
++ ##
+ # Workarounds for issues with File
+ ##
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20060922/e231b60b/attachment.html
More information about the calendarserver-changes
mailing list