[Python-modules-commits] r12531 - in packages/python-cherrypy/trunk/debian (2 files)

kitterma-guest at users.alioth.debian.org kitterma-guest at users.alioth.debian.org
Thu Apr 8 00:15:17 UTC 2010


    Date: Thursday, April 8, 2010 @ 00:14:56
  Author: kitterma-guest
Revision: 12531

Port to hashlib to fix md5/sha deprecation warnings with Python 2.6.

Added:
  packages/python-cherrypy/trunk/debian/patches/04_use_hashlib.diff
Modified:
  packages/python-cherrypy/trunk/debian/changelog

Modified: packages/python-cherrypy/trunk/debian/changelog
===================================================================
--- packages/python-cherrypy/trunk/debian/changelog	2010-04-07 11:57:51 UTC (rev 12530)
+++ packages/python-cherrypy/trunk/debian/changelog	2010-04-08 00:14:56 UTC (rev 12531)
@@ -1,3 +1,10 @@
+python-cherrypy (2.3.0-4) UNRELEASED; urgency=low
+
+  * Add debian/patches/04_use_hashlib.diff to port from sha/md5 to hashlib and
+    fix deprecation warnings with Python 2.6
+
+ -- Scott Kitterman <scott at kitterman.com>  Wed, 07 Apr 2010 20:05:00 -0400
+
 python-cherrypy (2.3.0-3) unstable; urgency=low
 
   * debian/control:

Added: packages/python-cherrypy/trunk/debian/patches/04_use_hashlib.diff
===================================================================
--- packages/python-cherrypy/trunk/debian/patches/04_use_hashlib.diff	                        (rev 0)
+++ packages/python-cherrypy/trunk/debian/patches/04_use_hashlib.diff	2010-04-08 00:14:56 UTC (rev 12531)
@@ -0,0 +1,41 @@
+diff -Nur -x '*.orig' -x '*~' python-cherrypy-2.3.0/cherrypy/filters/sessionfilter.py python-cherrypy-2.3.0.new/cherrypy/filters/sessionfilter.py
+--- python-cherrypy-2.3.0/cherrypy/filters/sessionfilter.py	2008-01-13 21:17:45.000000000 -0500
++++ python-cherrypy-2.3.0.new/cherrypy/filters/sessionfilter.py	2010-04-07 20:03:41.000000000 -0400
+@@ -30,7 +30,7 @@
+ except ImportError:
+     import pickle
+ import random
+-import sha
++import hashlib
+ import time
+ import thread
+ import threading
+@@ -450,7 +450,7 @@
+     # os.urandom not available until Python 2.4. Fall back to random.random.
+     def generate_session_id():
+         """Return a new session id."""
+-        return sha.new('%s' % random.random()).hexdigest()
++        return hashlib.sha('%s' % random.random()).hexdigest()
+ else:
+     def generate_session_id():
+         """Return a new session id."""
+diff -Nur -x '*.orig' -x '*~' python-cherrypy-2.3.0/cherrypy/lib/cptools.py python-cherrypy-2.3.0.new/cherrypy/lib/cptools.py
+--- python-cherrypy-2.3.0/cherrypy/lib/cptools.py	2008-01-13 21:17:44.000000000 -0500
++++ python-cherrypy-2.3.0.new/cherrypy/lib/cptools.py	2010-04-07 20:03:55.000000000 -0400
+@@ -1,6 +1,6 @@
+ """Tools which both CherryPy and application developers may invoke."""
+ 
+-import md5
++import hashlib
+ import mimetools
+ import mimetypes
+ mimetypes.init()
+@@ -99,7 +99,7 @@
+     if (not etag) and autotags:
+         if status == 200:
+             etag = response.collapse_body()
+-            etag = '"%s"' % md5.new(etag).hexdigest()
++            etag = '"%s"' % hashlib.md5(etag).hexdigest()
+             response.headers['ETag'] = etag
+     
+     response.ETag = etag




More information about the Python-modules-commits mailing list