mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-24 16:10:02 -06:00
Fix Python 2.6 deprecation warning with the md5 import. Use hashlib instead.
This commit is contained in:
parent
944371a38c
commit
30f9f77727
@ -529,8 +529,11 @@ def uuid1(node=None, clock_seq=None):
|
|||||||
|
|
||||||
def uuid3(namespace, name):
|
def uuid3(namespace, name):
|
||||||
"""Generate a UUID from the MD5 hash of a namespace UUID and a name."""
|
"""Generate a UUID from the MD5 hash of a namespace UUID and a name."""
|
||||||
import md5
|
try:
|
||||||
hash = md5.md5(namespace.bytes + name).digest()
|
from hashlib import md5
|
||||||
|
except ImportError:
|
||||||
|
from md5 import md5
|
||||||
|
hash = md5(namespace.bytes + name).digest()
|
||||||
return UUID(bytes=hash[:16], version=3)
|
return UUID(bytes=hash[:16], version=3)
|
||||||
|
|
||||||
def uuid4():
|
def uuid4():
|
||||||
|
Loading…
Reference in New Issue
Block a user