From 2779da3096450ea08ced146e7455ae4a764dac71 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Fri, 12 Feb 2010 10:55:09 -0500 Subject: Fix deprecation error importing sha --- ipalib/ipauuid.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ipalib') diff --git a/ipalib/ipauuid.py b/ipalib/ipauuid.py index 25bd70aaa..59753d048 100644 --- a/ipalib/ipauuid.py +++ b/ipalib/ipauuid.py @@ -555,8 +555,11 @@ def uuid4(): def uuid5(namespace, name): """Generate a UUID from the SHA-1 hash of a namespace UUID and a name.""" - import sha - hash = sha.sha(namespace.bytes + name).digest() + try: + from hashlib import sha1 as sha + except ImportError: + from sha import sha + hash = sha(namespace.bytes + name).digest() return UUID(bytes=hash[:16], version=5) # The following standard UUIDs are for use with uuid3() or uuid5(). -- cgit