[CalendarServer-changes] [3887] CalendarServer/branches/exarkun/update-twisted-3816

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 18 15:15:36 PDT 2009


Revision: 3887
          http://trac.macosforge.org/projects/calendarserver/changeset/3887
Author:   exarkun at twistedmatrix.com
Date:     2009-03-18 15:15:34 -0700 (Wed, 18 Mar 2009)
Log Message:
-----------
md5 stream wrapper moved to Twisted

Modified Paths:
--------------
    CalendarServer/branches/exarkun/update-twisted-3816/run

Removed Paths:
-------------
    CalendarServer/branches/exarkun/update-twisted-3816/lib-patches/Twisted/twisted.web2.dav.stream.patch
    CalendarServer/branches/exarkun/update-twisted-3816/lib-patches/Twisted/twisted.web2.dav.test.test_stream.patch

Deleted: CalendarServer/branches/exarkun/update-twisted-3816/lib-patches/Twisted/twisted.web2.dav.stream.patch
===================================================================
--- CalendarServer/branches/exarkun/update-twisted-3816/lib-patches/Twisted/twisted.web2.dav.stream.patch	2009-03-18 21:48:41 UTC (rev 3886)
+++ CalendarServer/branches/exarkun/update-twisted-3816/lib-patches/Twisted/twisted.web2.dav.stream.patch	2009-03-18 22:15:34 UTC (rev 3887)
@@ -1,84 +0,0 @@
-Index: twisted/web2/dav/stream.py
-===================================================================
---- twisted/web2/dav/stream.py	(revision 0)
-+++ twisted/web2/dav/stream.py	(revision 0)
-@@ -0,0 +1,79 @@
-+##
-+# Copyright (c) 2005-2007 Apple Inc. All rights reserved.
-+#
-+# Permission is hereby granted, free of charge, to any person obtaining a copy
-+# of this software and associated documentation files (the "Software"), to deal
-+# in the Software without restriction, including without limitation the rights
-+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-+# copies of the Software, and to permit persons to whom the Software is
-+# furnished to do so, subject to the following conditions:
-+# 
-+# The above copyright notice and this permission notice shall be included in all
-+# copies or substantial portions of the Software.
-+# 
-+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-+# SOFTWARE.
-+#
-+# DRI: Cyrus Daboo, cdaboo at apple.com
-+##
-+
-+"""
-+Class that implements a stream that calculates the MD5 hash of the data
-+as the data is read.
-+"""
-+
-+__all__ = ["MD5StreamWrapper"]
-+
-+from twisted.internet.defer import Deferred
-+from twisted.web2.stream import SimpleStream
-+
-+try:
-+    from hashlib import md5
-+except ImportError:
-+    import md5.new as md5
-+
-+class MD5StreamWrapper(SimpleStream):
-+ 
-+    def __init__(self, wrap):
-+        
-+        assert wrap is not None, "Must have a stream to wrap."
-+
-+        self.stream = wrap
-+
-+        # Init MD5
-+        self.md5 = md5()
-+    
-+    def read(self):
-+        assert self.md5 is not None, "Cannot call read after close."
-+
-+        # Read from wrapped stream first
-+        b = self.stream.read()
-+        
-+        if isinstance(b, Deferred):
-+            def _gotData(data):
-+                if data is not None:
-+                    self.md5.update(data)
-+                return data
-+            b.addCallback(_gotData)
-+        else:
-+            # Update current MD5 state
-+            if b is not None:
-+                self.md5.update(str(b))
-+    
-+        return b
-+    
-+    def close(self):
-+        # Close out the MD5 hash
-+        self.md5value = self.md5.hexdigest()
-+        self.md5 = None
-+
-+        SimpleStream.close(self)
-+    
-+    def getMD5(self):
-+        assert hasattr(self, "md5value"), "Stream has to be closed first"
-+        return self.md5value

Deleted: CalendarServer/branches/exarkun/update-twisted-3816/lib-patches/Twisted/twisted.web2.dav.test.test_stream.patch
===================================================================
--- CalendarServer/branches/exarkun/update-twisted-3816/lib-patches/Twisted/twisted.web2.dav.test.test_stream.patch	2009-03-18 21:48:41 UTC (rev 3886)
+++ CalendarServer/branches/exarkun/update-twisted-3816/lib-patches/Twisted/twisted.web2.dav.test.test_stream.patch	2009-03-18 22:15:34 UTC (rev 3887)
@@ -1,56 +0,0 @@
-Index: twisted/web2/dav/test/test_stream.py
-===================================================================
---- twisted/web2/dav/test/test_stream.py	(revision 0)
-+++ twisted/web2/dav/test/test_stream.py	(revision 0)
-@@ -0,0 +1,51 @@
-+##
-+# Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
-+#
-+# Permission is hereby granted, free of charge, to any person obtaining a copy
-+# of this software and associated documentation files (the "Software"), to deal
-+# in the Software without restriction, including without limitation the rights
-+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-+# copies of the Software, and to permit persons to whom the Software is
-+# furnished to do so, subject to the following conditions:
-+# 
-+# The above copyright notice and this permission notice shall be included in all
-+# copies or substantial portions of the Software.
-+# 
-+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-+# SOFTWARE.
-+##
-+
-+from twisted.trial import unittest
-+from twisted.web2.stream import MemoryStream
-+from twisted.web2.dav.stream import MD5StreamWrapper
-+import md5
-+
-+class Stream(unittest.TestCase):
-+    """
-+    MD5StreamWrapper tests.
-+    """
-+    def test_simple(self):
-+        """
-+        Simple test
-+        """
-+        
-+        data = """I am sorry Dave, I can't do that.
-+--HAL 9000
-+"""
-+
-+        datastream = MemoryStream(data)
-+        stream = MD5StreamWrapper(datastream)
-+        
-+        while stream.read() is not None:
-+            pass
-+        stream.close()
-+
-+        m = md5.new()
-+        m.update(data)
-+        
-+        self.assertEqual(m.hexdigest(), stream.getMD5())

Modified: CalendarServer/branches/exarkun/update-twisted-3816/run
===================================================================
--- CalendarServer/branches/exarkun/update-twisted-3816/run	2009-03-18 21:48:41 UTC (rev 3886)
+++ CalendarServer/branches/exarkun/update-twisted-3816/run	2009-03-18 22:15:34 UTC (rev 3887)
@@ -636,7 +636,7 @@
     ;;
 esac;
 svn_uri="${proto}://svn.twistedmatrix.com/svn/Twisted/branches/dav-take-two-3081-3";
-svn_get "Twisted" "${twisted}" "${svn_uri}" 26347;
+svn_get "Twisted" "${twisted}" "${svn_uri}" 26422;
 
 # No py_build step, since we tend to do edit Twisted, we want the sources in
 # PYTHONPATH, not a build directory.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090318/465bce23/attachment-0001.html>


More information about the calendarserver-changes mailing list