[Mpuls-commits] r5777 - in base/trunk: . ez_setup mpulsweb/controllers mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Jan 19 13:57:47 CET 2012


Author: ludwig
Date: 2012-01-19 13:57:45 +0100 (Thu, 19 Jan 2012)
New Revision: 5777

Modified:
   base/trunk/ChangeLog
   base/trunk/ez_setup/__init__.py
   base/trunk/mpulsweb/controllers/auth.py
   base/trunk/mpulsweb/lib/base.py
   base/trunk/mpulsweb/lib/security.py
Log:
Use module hashlib instead of md5, because Md5 is deprecated 
  in Python 2.6.

Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2012-01-19 12:32:38 UTC (rev 5776)
+++ base/trunk/ChangeLog	2012-01-19 12:57:45 UTC (rev 5777)
@@ -1,5 +1,14 @@
 2011-08-19  Ludwig Reiter  <ludwig.reiter at intevation.de>
 
+	* ez_setup/__init__.py,
+	  mpulsweb/controllers/auth.py,
+	  mpulsweb/lib/security.py,
+	  mpulsweb/lib/base.py:
+	  Use module hashlib instead of md5, because Md5 is deprecated 
+	  in Python 2.6.
+
+2011-08-19  Ludwig Reiter  <ludwig.reiter at intevation.de>
+
 	* mpulsweb/lib/formedrenderer.py:
 	Fix url_for at id=0 problem, use url_for once.
 

Modified: base/trunk/ez_setup/__init__.py
===================================================================
--- base/trunk/ez_setup/__init__.py	2012-01-19 12:32:38 UTC (rev 5776)
+++ base/trunk/ez_setup/__init__.py	2012-01-19 12:57:45 UTC (rev 5777)
@@ -74,7 +74,7 @@
 
 def _validate_md5(egg_name, data):
     if egg_name in md5_data:
-        from md5 import md5
+        from hashlib import md5
         digest = md5(data).hexdigest()
         if digest != md5_data[egg_name]:
             print >>sys.stderr, (
@@ -218,7 +218,7 @@
     """Update our built-in md5 registry"""
 
     import re
-    from md5 import md5
+    from hashlib import md5
 
     for name in filenames:
         base = os.path.basename(name)

Modified: base/trunk/mpulsweb/controllers/auth.py
===================================================================
--- base/trunk/mpulsweb/controllers/auth.py	2012-01-19 12:32:38 UTC (rev 5776)
+++ base/trunk/mpulsweb/controllers/auth.py	2012-01-19 12:57:45 UTC (rev 5777)
@@ -1,5 +1,5 @@
 import logging
-import md5
+import hashlib
 
 from pylons import request, response, tmpl_context as c
 from pylons.controllers.util import redirect_to
@@ -48,7 +48,7 @@
                 c.login_failed = False
                 shared = generateID()
                 session['USER_AUTHORIZED'] = user
-                session['AUTH'] = md5.new(shared + userIdentity()).digest()
+                session['AUTH'] = hashlib.md5(shared + userIdentity()).digest()
                 session.save()
 
                 # Does only work work with enabled ssl. secure means that the

Modified: base/trunk/mpulsweb/lib/base.py
===================================================================
--- base/trunk/mpulsweb/lib/base.py	2012-01-19 12:32:38 UTC (rev 5776)
+++ base/trunk/mpulsweb/lib/base.py	2012-01-19 12:57:45 UTC (rev 5777)
@@ -28,7 +28,7 @@
 utilized by Controllers.
 """
 
-import md5
+import hashlib
 import logging
 import locale
 from time import time
@@ -195,7 +195,7 @@
                           auth_cookie_name())
                 raise HTTPUnauthorized(detail=COOKIE_NOT_FOUND)
 
-            if storedHash != md5.new(shared + userIdentity()).digest():
+            if storedHash != hashlib.md5(shared + userIdentity()).digest():
                 log.error("Stored hash doesn't match new hash "
                           "-> HTTPUnauthorized")
                 raise HTTPUnauthorized(detail=IDENTITY_CHANGED)

Modified: base/trunk/mpulsweb/lib/security.py
===================================================================
--- base/trunk/mpulsweb/lib/security.py	2012-01-19 12:32:38 UTC (rev 5776)
+++ base/trunk/mpulsweb/lib/security.py	2012-01-19 12:57:45 UTC (rev 5777)
@@ -33,7 +33,7 @@
 import time
 import re
 import random
-import md5
+import hashlib
 import logging
 from codecs import getdecoder
 from types import ListType, TupleType
@@ -176,7 +176,7 @@
     array = [time.time(), os.times(), random.random()]
     if not obj is None:
         array.append(id(obj))
-    return md5.new(str(array)).hexdigest()
+    return hashlib.md5(str(array)).hexdigest()
 
 def subnet(addr):
     """poor man's subnet splitting"""



More information about the Mpuls-commits mailing list