Commits

Anonymous committed 7456b33

fixing error with import of md5 when hashlib is available

Comments (0)

Files changed (1)

satchmo/trunk/satchmo/apps/keyedcache/__init__.py

 try:
     from hashlib import md5
 except ImportError:
-    import md5
+    import md5 as md5_old
+    md5 = md5_old.new
+
 import types
 import logging
 from satchmo_utils import is_string_like, is_list_or_tuple
     
 def md5_hash(obj):
     pickled = pickle.dumps(obj, protocol=pickle.HIGHEST_PROTOCOL)
-    return md5.new(pickled).hexdigest()
+    return md5(pickled).hexdigest()
 
 
 def is_memcached_backend():