Update deprecated module usage.
authorGlenn Maynard <glenn@zewt.org>
Thu, 28 Apr 2011 16:08:41 +0000 (12:08 -0400)
committerGlenn Maynard <glenn@zewt.org>
Thu, 28 Apr 2011 16:08:41 +0000 (12:08 -0400)
The sha module is deprecated.  Use hashlib.sha1 instead.  This fixes a
Python warning on startup.

punjab/httpb.py

index d76b829..66fdcb2 100644 (file)
@@ -13,7 +13,7 @@ try:
 except ImportError:
     from twisted.xish import domish
 
-import sha, time
+import hashlib, time
 import error
 from session import make_session
 import punjab
@@ -719,8 +719,7 @@ class HttpbService(punjab.Service):
             try:
                 if body.hasAttribute('key') and not foundNewKey:
                     if s.key is not None:
-                        nk = sha.new(body['key'])
-                        key = nk.hexdigest()
+                        key = hashlib.sha1(body['key']).hexdigest()
                         next_key = body['key']
                         if key == s.key:
                             s.key = next_key