[CalendarServer-changes] [3250] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Tue Oct 28 16:23:51 PDT 2008


Revision: 3250
          http://trac.macosforge.org/projects/calendarserver/changeset/3250
Author:   wsanchez at apple.com
Date:     2008-10-28 16:23:50 -0700 (Tue, 28 Oct 2008)
Log Message:
-----------
md5 module is deprecated, use hashlib

Modified Paths:
--------------
    CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.method.put_common.patch
    CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.stream.patch
    CalendarServer/trunk/lib-patches/Twisted/twisted.web2.static.patch
    CalendarServer/trunk/twistedcaldav/method/report_common.py
    CalendarServer/trunk/twistedcaldav/scheduling/caldav.py

Added Paths:
-----------
    CalendarServer/trunk/lib-patches/Twisted/twisted.internet._sslverify.patch
    CalendarServer/trunk/lib-patches/Twisted/twisted.mail.pop3client.patch
    CalendarServer/trunk/lib-patches/Twisted/twisted.persisted.sob.patch
    CalendarServer/trunk/lib-patches/Twisted/twisted.python.filepath.patch
    CalendarServer/trunk/lib-patches/Twisted/twisted.spread.pb.patch
    CalendarServer/trunk/lib-patches/Twisted/twisted.words.protocols.jabber.sasl_mechanisms.patch
    CalendarServer/trunk/lib-patches/vobject/setuptools-0.6c8-py2.5.patch

Added: CalendarServer/trunk/lib-patches/Twisted/twisted.internet._sslverify.patch
===================================================================
--- CalendarServer/trunk/lib-patches/Twisted/twisted.internet._sslverify.patch	                        (rev 0)
+++ CalendarServer/trunk/lib-patches/Twisted/twisted.internet._sslverify.patch	2008-10-28 23:23:50 UTC (rev 3250)
@@ -0,0 +1,35 @@
+Index: twisted/internet/_sslverify.py
+===================================================================
+--- twisted/internet/_sslverify.py	(revision 19773)
++++ twisted/internet/_sslverify.py	(working copy)
+@@ -1,7 +1,11 @@
+ # -*- test-case-name: twisted.test.test_sslverify -*-
+ # Copyright 2005 Divmod, Inc.  See LICENSE file for details
+ 
+-import itertools, md5
++import itertools
++try:
++    from hashlib import md5
++except ImportError:
++    import md5.new as md5
+ from OpenSSL import SSL, crypto
+ 
+ from twisted.python import reflect, util
+@@ -666,7 +670,7 @@
+         MD5 hex digest of signature on an empty certificate request with this
+         key.
+         """
+-        return md5.md5(self._emptyReq).hexdigest()
++        return md5(self._emptyReq).hexdigest()
+ 
+ 
+     def inspect(self):
+@@ -942,7 +946,7 @@
+             ctx.set_options(self._OP_ALL)
+ 
+         if self.enableSessions:
+-            sessionName = md5.md5("%s-%d" % (reflect.qual(self.__class__), _sessionCounter())).hexdigest()
++            sessionName = md5("%s-%d" % (reflect.qual(self.__class__), _sessionCounter())).hexdigest()
+             ctx.set_session_id(sessionName)
+ 
+         return ctx

Added: CalendarServer/trunk/lib-patches/Twisted/twisted.mail.pop3client.patch
===================================================================
--- CalendarServer/trunk/lib-patches/Twisted/twisted.mail.pop3client.patch	                        (rev 0)
+++ CalendarServer/trunk/lib-patches/Twisted/twisted.mail.pop3client.patch	2008-10-28 23:23:50 UTC (rev 3250)
@@ -0,0 +1,28 @@
+Index: twisted/mail/pop3client.py
+===================================================================
+--- twisted/mail/pop3client.py	(revision 19773)
++++ twisted/mail/pop3client.py	(working copy)
+@@ -11,8 +11,13 @@
+ API Stability: Unstable
+ """
+ 
+-import re, md5
++import re
+ 
++try:
++    from hashlib import md5
++except ImportError:
++    import md5.new as md5
++
+ from twisted.python import log
+ from twisted.internet import defer
+ from twisted.protocols import basic
+@@ -486,7 +491,7 @@
+     def _apop(self, username, password, challenge):
+         # Internal helper.  Computes and sends an APOP response.  Returns
+         # a Deferred that fires when the server responds to the response.
+-        digest = md5.new(challenge + password).hexdigest()
++        digest = md5(challenge + password).hexdigest()
+         return self.apop(username, digest)
+ 
+     def apop(self, username, digest):

Added: CalendarServer/trunk/lib-patches/Twisted/twisted.persisted.sob.patch
===================================================================
--- CalendarServer/trunk/lib-patches/Twisted/twisted.persisted.sob.patch	                        (rev 0)
+++ CalendarServer/trunk/lib-patches/Twisted/twisted.persisted.sob.patch	2008-10-28 23:23:50 UTC (rev 3250)
@@ -0,0 +1,32 @@
+Index: twisted/persisted/sob.py
+===================================================================
+--- twisted/persisted/sob.py	(revision 19773)
++++ twisted/persisted/sob.py	(working copy)
+@@ -10,8 +10,12 @@
+ Maintainer: U{Moshe Zadka<mailto:moshez at twistedmatrix.com>}
+ """
+ 
+-import os, md5, sys
++import os, sys
+ try:
++    from hashlib import md5
++except ImportError:
++    import md5.new as md5
++try:
+     import cPickle as pickle
+ except ImportError:
+     import pickle
+@@ -32,11 +36,11 @@
+     leftover = len(data) % cipher.block_size
+     if leftover:
+         data += ' '*(cipher.block_size - leftover)
+-    return cipher.new(md5.new(passphrase).digest()[:16]).encrypt(data)
++    return cipher.new(md5(passphrase).digest()[:16]).encrypt(data)
+ 
+ def _decrypt(passphrase, data):
+     from Crypto.Cipher import AES
+-    return AES.new(md5.new(passphrase).digest()[:16]).decrypt(data)
++    return AES.new(md5(passphrase).digest()[:16]).decrypt(data)
+ 
+ 
+ class IPersistable(Interface):

Added: CalendarServer/trunk/lib-patches/Twisted/twisted.python.filepath.patch
===================================================================
--- CalendarServer/trunk/lib-patches/Twisted/twisted.python.filepath.patch	                        (rev 0)
+++ CalendarServer/trunk/lib-patches/Twisted/twisted.python.filepath.patch	2008-10-28 23:23:50 UTC (rev 3250)
@@ -0,0 +1,28 @@
+Index: twisted/python/filepath.py
+===================================================================
+--- twisted/python/filepath.py	(revision 19773)
++++ twisted/python/filepath.py	(working copy)
+@@ -9,9 +9,13 @@
+ import os
+ import errno
+ import random
+-import sha
+ import base64
+ 
++try:
++    from hashlib import sha1
++except ImportError:
++    import sha.new as sha1
++
+ from os.path import isabs, exists, normpath, abspath, splitext
+ from os.path import basename, dirname
+ from os.path import join as joinpath
+@@ -109,7 +113,7 @@
+     """
+     Create a pseudorandom, 16-character string for use in secure filenames.
+     """
+-    return armor(sha.new(randomBytes(64)).digest())[:16]
++    return armor(sha1(randomBytes(64)).digest())[:16]
+ 
+ class _PathHelper:
+     """

Added: CalendarServer/trunk/lib-patches/Twisted/twisted.spread.pb.patch
===================================================================
--- CalendarServer/trunk/lib-patches/Twisted/twisted.spread.pb.patch	                        (rev 0)
+++ CalendarServer/trunk/lib-patches/Twisted/twisted.spread.pb.patch	2008-10-28 23:23:50 UTC (rev 3250)
@@ -0,0 +1,53 @@
+Index: twisted/spread/pb.py
+===================================================================
+--- twisted/spread/pb.py	(revision 19773)
++++ twisted/spread/pb.py	(working copy)
+@@ -64,7 +64,11 @@
+ except ImportError:
+     import StringIO
+ 
+-import md5
++try:
++    from hashlib import md5
++except ImportError:
++    import md5.new as md5
++
+ import random
+ import new
+ import types
+@@ -1003,10 +1007,10 @@
+ 
+     This is useful for challenge/response authentication.
+     """
+-    m = md5.new()
++    m = md5()
+     m.update(password)
+     hashedPassword = m.digest()
+-    m = md5.new()
++    m = md5()
+     m.update(hashedPassword)
+     m.update(challenge)
+     doubleHashedPassword = m.digest()
+@@ -1017,7 +1021,7 @@
+     crap = ''
+     for x in range(random.randrange(15,25)):
+         crap = crap + chr(random.randint(65,90))
+-    crap = md5.new(crap).digest()
++    crap = md5(crap).digest()
+     return crap
+ 
+ 
+@@ -1226,11 +1230,11 @@
+ 
+     # IUsernameHashedPassword:
+     def checkPassword(self, password):
+-        return self.checkMD5Password(md5.md5(password).digest())
++        return self.checkMD5Password(md5(password).digest())
+ 
+     # IUsernameMD5Password
+     def checkMD5Password(self, md5Password):
+-        md = md5.new()
++        md = md5()
+         md.update(md5Password)
+         md.update(self.challenge)
+         correct = md.digest()

Modified: CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.method.put_common.patch
===================================================================
--- CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.method.put_common.patch	2008-10-28 23:13:09 UTC (rev 3249)
+++ CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.method.put_common.patch	2008-10-28 23:23:50 UTC (rev 3250)
@@ -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,267 @@
+@@ -0,0 +1,265 @@
 +##
 +# Copyright (c) 2005-2007 Apple Inc. All rights reserved.
 +#
@@ -44,8 +44,6 @@
 +from twisted.web2.iweb import IResponse
 +from twisted.web2.stream import MemoryStream
 +
-+import md5
-+
 +def storeResource(
 +    request,
 +    source=None, source_uri=None, data=None,

Modified: CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.stream.patch
===================================================================
--- CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.stream.patch	2008-10-28 23:13:09 UTC (rev 3249)
+++ CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.stream.patch	2008-10-28 23:23:50 UTC (rev 3250)
@@ -2,7 +2,7 @@
 ===================================================================
 --- twisted/web2/dav/stream.py	(revision 0)
 +++ twisted/web2/dav/stream.py	(revision 0)
-@@ -0,0 +1,76 @@
+@@ -0,0 +1,79 @@
 +##
 +# Copyright (c) 2005-2007 Apple Inc. All rights reserved.
 +#
@@ -37,7 +37,10 @@
 +from twisted.internet.defer import Deferred
 +from twisted.web2.stream import SimpleStream
 +
-+import md5
++try:
++    from hashlib import md5
++except ImportError:
++    import md5.new as md5
 +
 +class MD5StreamWrapper(SimpleStream):
 + 
@@ -48,7 +51,7 @@
 +        self.stream = wrap
 +
 +        # Init MD5
-+        self.md5 = md5.new()
++        self.md5 = md5()
 +    
 +    def read(self):
 +        assert self.md5 is not None, "Cannot call read after close."

Modified: CalendarServer/trunk/lib-patches/Twisted/twisted.web2.static.patch
===================================================================
--- CalendarServer/trunk/lib-patches/Twisted/twisted.web2.static.patch	2008-10-28 23:13:09 UTC (rev 3249)
+++ CalendarServer/trunk/lib-patches/Twisted/twisted.web2.static.patch	2008-10-28 23:23:50 UTC (rev 3250)
@@ -2,7 +2,15 @@
 ===================================================================
 --- twisted/web2/static.py	(revision 19773)
 +++ twisted/web2/static.py	(working copy)
-@@ -200,7 +200,10 @@
+@@ -9,7 +9,6 @@
+ # System Imports
+ import os, time, stat
+ import tempfile
+-import md5
+ 
+ # Sibling Imports
+ from twisted.web2 import http_headers, resource
+@@ -200,7 +199,10 @@
          super(File, self).__init__()
  
          self.putChildren = {}
@@ -14,7 +22,7 @@
          # Remove the dots from the path to split
          self.defaultType = defaultType
          self.ignoredExts = list(ignoredExts)
-@@ -383,7 +386,7 @@
+@@ -383,7 +385,7 @@
              return responsecode.NOT_FOUND
  
          if self.fp.isdir():

Added: CalendarServer/trunk/lib-patches/Twisted/twisted.words.protocols.jabber.sasl_mechanisms.patch
===================================================================
--- CalendarServer/trunk/lib-patches/Twisted/twisted.words.protocols.jabber.sasl_mechanisms.patch	                        (rev 0)
+++ CalendarServer/trunk/lib-patches/Twisted/twisted.words.protocols.jabber.sasl_mechanisms.patch	2008-10-28 23:23:50 UTC (rev 3250)
@@ -0,0 +1,34 @@
+Index: twisted/words/protocols/jabber/sasl_mechanisms.py
+===================================================================
+--- twisted/words/protocols/jabber/sasl_mechanisms.py	(revision 19773)
++++ twisted/words/protocols/jabber/sasl_mechanisms.py	(working copy)
+@@ -7,8 +7,13 @@
+ Protocol agnostic implementations of SASL authentication mechanisms.
+ """
+ 
+-import md5, binascii, random, time, os
++import binascii, random, time, os
+ 
++try:
++    from hashlib import md5
++except ImportError:
++    import md5.new as md5
++
+ from zope.interface import Interface, Attribute, implements
+ 
+ class ISASLMechanism(Interface):
+@@ -153,7 +158,7 @@
+         """
+ 
+         def H(s):
+-            return md5.new(s).digest()
++            return md5(s).digest()
+ 
+         def HEX(n):
+             return binascii.b2a_hex(n)
+@@ -196,4 +201,4 @@
+ 
+ 
+     def _gen_nonce(self):
+-        return md5.new("%s:%s:%s" % (str(random.random()) , str(time.gmtime()),str(os.getpid()))).hexdigest()
++        return md5("%s:%s:%s" % (str(random.random()) , str(time.gmtime()),str(os.getpid()))).hexdigest()

Added: CalendarServer/trunk/lib-patches/vobject/setuptools-0.6c8-py2.5.patch
===================================================================
--- CalendarServer/trunk/lib-patches/vobject/setuptools-0.6c8-py2.5.patch	                        (rev 0)
+++ CalendarServer/trunk/lib-patches/vobject/setuptools-0.6c8-py2.5.patch	2008-10-28 23:23:50 UTC (rev 3250)
@@ -0,0 +1,10 @@
+Index: setuptools-0.6c8-py2.5.egg
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: setuptools-0.6c8-py2.5.egg
+___________________________________________________________________
+Added: svn:mime-type
+   + application/octet-stream
+

Modified: CalendarServer/trunk/twistedcaldav/method/report_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_common.py	2008-10-28 23:13:09 UTC (rev 3249)
+++ CalendarServer/trunk/twistedcaldav/method/report_common.py	2008-10-28 23:23:50 UTC (rev 3250)
@@ -29,9 +29,13 @@
 ]
 
 import datetime
-import md5
 import time
 
+try:
+    from hashlib import md5
+except ImportError:
+    import md5.new as md5
+
 from vobject.icalendar import utc
 
 from twisted.internet.defer import inlineCallbacks, returnValue
@@ -616,7 +620,7 @@
     if uid is not None:
         fb.addProperty(Property("UID", uid))
     else:
-        uid = md5.new(str(fbcalendar) + str(time.time())).hexdigest()
+        uid = md5(str(fbcalendar) + str(time.time())).hexdigest()
         fb.addProperty(Property("UID", uid))
 
     return fbcalendar

Modified: CalendarServer/trunk/twistedcaldav/scheduling/caldav.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/caldav.py	2008-10-28 23:13:09 UTC (rev 3249)
+++ CalendarServer/trunk/twistedcaldav/scheduling/caldav.py	2008-10-28 23:23:50 UTC (rev 3250)
@@ -14,10 +14,15 @@
 # limitations under the License.
 ##
 
+import time
+
+try:
+    from hashlib import md5
+except ImportError:
+    import md5.new as md5
+
 from twisted.internet.defer import inlineCallbacks, returnValue
-
 from twisted.python.failure import Failure
-
 from twisted.web2 import responsecode
 from twisted.web2.dav import davxml
 from twisted.web2.dav.http import ErrorResponse
@@ -32,16 +37,11 @@
 from twistedcaldav.log import Logger
 from twistedcaldav.method import report_common
 from twistedcaldav.resource import isCalendarCollectionResource
-from twistedcaldav.scheduling.cuaddress import LocalCalendarUser,\
-    RemoteCalendarUser
+from twistedcaldav.scheduling.cuaddress import LocalCalendarUser, RemoteCalendarUser
 from twistedcaldav.scheduling.delivery import DeliveryService
 from twistedcaldav.scheduling.itip import iTIPRequestStatus
-from twistedcaldav.scheduling.processing import ImplicitProcessor,\
-    ImplicitProcessorException
+from twistedcaldav.scheduling.processing import ImplicitProcessor, ImplicitProcessorException
 
-import md5
-import time
-
 """
 Class that handles delivery of scheduling messages via CalDAV.
 """
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081028/045aef7d/attachment-0001.html>


More information about the calendarserver-changes mailing list