[Checkins] SVN: zc.sourcefactory/trunk/ Use hashlib for Python 2.5 and later to avoid deprecation warnings.

Jim Fulton jim at zope.com
Sat Aug 15 16:12:22 EDT 2009


Log message for revision 102833:
  Use hashlib for Python 2.5 and later to avoid deprecation warnings.
  

Changed:
  U   zc.sourcefactory/trunk/CHANGES.txt
  U   zc.sourcefactory/trunk/src/zc/sourcefactory/browser/token.py

-=-
Modified: zc.sourcefactory/trunk/CHANGES.txt
===================================================================
--- zc.sourcefactory/trunk/CHANGES.txt	2009-08-15 20:02:06 UTC (rev 102832)
+++ zc.sourcefactory/trunk/CHANGES.txt	2009-08-15 20:12:22 UTC (rev 102833)
@@ -2,14 +2,16 @@
 Changes
 =======
 
-0.6.0 (unreleased)
+0.6.0 (2009-08-15)
 ==================
 
     - Change package homepage to PyPI instead of Subversion.
 
     - Dropped Support for Zope 3.2 by removing a conditional import.
 
+    - Use hashlib for Python 2.5 and later to avoid deprecation warnings.
 
+
 0.5.0 (2009-02-03)
 ==================
 

Modified: zc.sourcefactory/trunk/src/zc/sourcefactory/browser/token.py
===================================================================
--- zc.sourcefactory/trunk/src/zc/sourcefactory/browser/token.py	2009-08-15 20:02:06 UTC (rev 102832)
+++ zc.sourcefactory/trunk/src/zc/sourcefactory/browser/token.py	2009-08-15 20:12:22 UTC (rev 102833)
@@ -16,9 +16,11 @@
 """
 __docformat__ = "reStructuredText"
 
+try:
+    import hashlib
+except ImportError:
+    import md5 as hashlib # Python 2.4 compat
 
-import md5
-
 import ZODB.utils
 import ZODB.interfaces
 import persistent.interfaces
@@ -35,7 +37,7 @@
 def fromString(value):
     # We hash generic strings to be sure they are suitable
     # for URL encoding.
-    return md5.md5(value).hexdigest()
+    return hashlib.md5(value).hexdigest()
 
 
 @zope.component.adapter(unicode)



More information about the Checkins mailing list