summaryrefslogtreecommitdiff
path: root/cherrypy/lib/cptools.py
diff options
context:
space:
mode:
authorRobert Brewer <fumanchu@aminus.org>2009-01-12 18:35:58 +0000
committerRobert Brewer <fumanchu@aminus.org>2009-01-12 18:35:58 +0000
commit89663cd2032bdae34709aea1f1a8977f16d6062a (patch)
tree8d9d3fe14e74124c89085e72943a9aaea3a36913 /cherrypy/lib/cptools.py
parent74bab52066eafe0138dc1fcaadda8461d199d6f9 (diff)
downloadcherrypy-git-89663cd2032bdae34709aea1f1a8977f16d6062a.tar.gz
Got rid of all the DeprecationWarning's when using Python 2.6.
Diffstat (limited to 'cherrypy/lib/cptools.py')
-rw-r--r--cherrypy/lib/cptools.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/cherrypy/lib/cptools.py b/cherrypy/lib/cptools.py
index eefd1ae7..5092d2ed 100644
--- a/cherrypy/lib/cptools.py
+++ b/cherrypy/lib/cptools.py
@@ -1,7 +1,11 @@
"""Functions for builtin CherryPy tools."""
import logging
-import md5
+try:
+ # Python 2.5+
+ from hashlib import md5
+except ImportError:
+ from md5 import new as md5
import re
import cherrypy
@@ -40,7 +44,7 @@ def validate_etags(autotags=False):
if (not etag) and autotags:
if status == 200:
etag = response.collapse_body()
- etag = '"%s"' % md5.new(etag).hexdigest()
+ etag = '"%s"' % md5(etag).hexdigest()
response.headers['ETag'] = etag
response.ETag = etag