[Checkins] SVN: z3c.hashedresource/trunk/ Restored compatibility with Python 2.4 by importing hashlib conditionally.

Thomas Lotze tl at gocept.com
Sun Sep 13 06:27:14 EDT 2009


Log message for revision 103893:
  Restored compatibility with Python 2.4 by importing hashlib conditionally.

Changed:
  U   z3c.hashedresource/trunk/CHANGES.txt
  U   z3c.hashedresource/trunk/src/z3c/hashedresource/hash.py

-=-
Modified: z3c.hashedresource/trunk/CHANGES.txt
===================================================================
--- z3c.hashedresource/trunk/CHANGES.txt	2009-09-13 10:21:43 UTC (rev 103892)
+++ z3c.hashedresource/trunk/CHANGES.txt	2009-09-13 10:27:13 UTC (rev 103893)
@@ -2,10 +2,10 @@
 CHANGES
 =======
 
-1.2 (unreleased)
-================
+1.1.2 (unreleased)
+==================
 
-- Nothing changed yet.
+- Restored compatibility with Python 2.4 by importing hashlib conditionally.
 
 
 1.1.1 (2009-08-25)

Modified: z3c.hashedresource/trunk/src/z3c/hashedresource/hash.py
===================================================================
--- z3c.hashedresource/trunk/src/z3c/hashedresource/hash.py	2009-09-13 10:21:43 UTC (rev 103892)
+++ z3c.hashedresource/trunk/src/z3c/hashedresource/hash.py	2009-09-13 10:27:13 UTC (rev 103893)
@@ -14,7 +14,10 @@
 
 from z3c.hashedresource import interfaces
 from zope.interface import implements, implementsOnly
-import hashlib
+try:
+    from hashlib import md5
+except ImportError:
+    from md5 import new as md5
 import os
 
 
@@ -32,7 +35,7 @@
         else:
             files = [path]
 
-        result = hashlib.new('md5')
+        result = md5()
         for file in files:
             f = open(file, 'rb')
             data = f.read()



More information about the checkins mailing list