summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2009-09-16 13:01:28 -0400
committerJason Gerard DeRose <jderose@redhat.com>2009-09-28 15:30:22 -0600
commit30f9f7772771a33f887ad1f4749352078e6c0fd4 (patch)
tree452fdb20c6f8693e65b7af16f58cb300e2d31f7e /ipalib
parent944371a38ca774d600c366726f3b734721f6fada (diff)
downloadfreeipa-30f9f7772771a33f887ad1f4749352078e6c0fd4.tar.gz
freeipa-30f9f7772771a33f887ad1f4749352078e6c0fd4.tar.xz
freeipa-30f9f7772771a33f887ad1f4749352078e6c0fd4.zip
Fix Python 2.6 deprecation warning with the md5 import. Use hashlib instead.
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/ipauuid.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/ipalib/ipauuid.py b/ipalib/ipauuid.py
index 19b8415ff..25bd70aaa 100644
--- a/ipalib/ipauuid.py
+++ b/ipalib/ipauuid.py
@@ -529,8 +529,11 @@ def uuid1(node=None, clock_seq=None):
def uuid3(namespace, name):
"""Generate a UUID from the MD5 hash of a namespace UUID and a name."""
- import md5
- hash = md5.md5(namespace.bytes + name).digest()
+ try:
+ from hashlib import md5
+ except ImportError:
+ from md5 import md5
+ hash = md5(namespace.bytes + name).digest()
return UUID(bytes=hash[:16], version=3)
def uuid4():