diff options
author | Robert Brewer <fumanchu@aminus.org> | 2009-01-12 18:35:58 +0000 |
---|---|---|
committer | Robert Brewer <fumanchu@aminus.org> | 2009-01-12 18:35:58 +0000 |
commit | 89663cd2032bdae34709aea1f1a8977f16d6062a (patch) | |
tree | 8d9d3fe14e74124c89085e72943a9aaea3a36913 /cherrypy/lib/httpauth.py | |
parent | 74bab52066eafe0138dc1fcaadda8461d199d6f9 (diff) | |
download | cherrypy-git-89663cd2032bdae34709aea1f1a8977f16d6062a.tar.gz |
Got rid of all the DeprecationWarning's when using Python 2.6.
Diffstat (limited to 'cherrypy/lib/httpauth.py')
-rw-r--r-- | cherrypy/lib/httpauth.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/cherrypy/lib/httpauth.py b/cherrypy/lib/httpauth.py index bc658244..285efe57 100644 --- a/cherrypy/lib/httpauth.py +++ b/cherrypy/lib/httpauth.py @@ -59,7 +59,11 @@ __all__ = ("digestAuth", "basicAuth", "doAuth", "checkResponse", "calculateNonce", "SUPPORTED_QOP") ################################################################################ -import md5 +try: + # Python 2.5+ + from hashlib import md5 +except ImportError: + from md5 import new as md5 import time import base64 import urllib2 @@ -76,8 +80,8 @@ SUPPORTED_QOP = (AUTH, AUTH_INT) # doAuth # DIGEST_AUTH_ENCODERS = { - MD5: lambda val: md5.new (val).hexdigest (), - MD5_SESS: lambda val: md5.new (val).hexdigest (), + MD5: lambda val: md5(val).hexdigest(), + MD5_SESS: lambda val: md5(val).hexdigest(), # SHA: lambda val: sha.new (val).hexdigest (), } |