Commits

bkr...@a38d40e9-c014-0410-b785-c606c0c8e7de  committed 7456b33

fixing error with import of md5 when hashlib is available

  • Participants
  • Parent commits dd9065e

Comments (0)

Files changed (1)

File 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():