[CalendarServer-changes] [3084] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Sep 26 17:26:20 PDT 2008


Revision: 3084
          http://trac.macosforge.org/projects/calendarserver/changeset/3084
Author:   wsanchez at apple.com
Date:     2008-09-26 17:26:20 -0700 (Fri, 26 Sep 2008)
Log Message:
-----------
sha, md5 are deprecated.  Use hashlib.

Modified Paths:
--------------
    CalendarServer/trunk/lib-patches/Twisted/twisted.web2.auth.digest.patch
    CalendarServer/trunk/twistedcaldav/directory/util.py

Modified: CalendarServer/trunk/lib-patches/Twisted/twisted.web2.auth.digest.patch
===================================================================
--- CalendarServer/trunk/lib-patches/Twisted/twisted.web2.auth.digest.patch	2008-09-27 00:07:05 UTC (rev 3083)
+++ CalendarServer/trunk/lib-patches/Twisted/twisted.web2.auth.digest.patch	2008-09-27 00:26:20 UTC (rev 3084)
@@ -2,7 +2,7 @@
 ===================================================================
 --- twisted/web2/auth/digest.py	(revision 19773)
 +++ twisted/web2/auth/digest.py	(working copy)
-@@ -11,6 +11,10 @@
+@@ -11,16 +11,24 @@
  from zope.interface import implements, Interface
  
  from twisted.web2.auth.interfaces import ICredentialFactory
@@ -11,9 +11,27 @@
 +from twisted.web2.http_headers import split
 +from twisted.web2.http_headers import parseKeyValue
  
- import md5, sha
+-import md5, sha
++try:
++    from hashlib import md5, sha1
++except ImportError:
++    import md5.new as md5
++    import sha.new as sha1
  import random, sys
-@@ -315,18 +319,18 @@
+ 
+ # The digest math
+ 
+ algorithms = {
+-    'md5': md5.new,
+-    'md5-sess': md5.new,
+-    'sha': sha.new,
++    'md5': md5,
++    'md5-sess': md5,
++    'sha': sha1,
+ }
+ 
+ # DigestCalcHA1
+@@ -315,18 +323,18 @@
          @raise: L{error.LoginFailed} if the response does not contain a
              username, a nonce, an opaque, or if the opaque is invalid.
          """

Modified: CalendarServer/trunk/twistedcaldav/directory/util.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/util.py	2008-09-27 00:07:05 UTC (rev 3083)
+++ CalendarServer/trunk/twistedcaldav/directory/util.py	2008-09-27 00:26:20 UTC (rev 3084)
@@ -23,7 +23,7 @@
     "NotFilePath",
 ]
 
-from sha import sha
+from hashlib import sha1
 
 def uuidFromName(namespace, name):
     """
@@ -47,7 +47,7 @@
         name = name.encode("utf-8")
 
     # Start with a SHA-1 hash of the namespace and name
-    uuid = sha(namespace + name).digest()[:16]
+    uuid = sha1(namespace + name).digest()[:16]
 
     # Convert from hexadecimal to long integer
     uuid = long("%02x"*16 % tuple(map(ord, uuid)), 16)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080926/765d9d6c/attachment.html 


More information about the calendarserver-changes mailing list