From 30f9f7772771a33f887ad1f4749352078e6c0fd4 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Wed, 16 Sep 2009 13:01:28 -0400 Subject: Fix Python 2.6 deprecation warning with the md5 import. Use hashlib instead. --- ipalib/ipauuid.py | 7 +++++-- 1 file 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(): -- cgit