From d4565882789134de5f31d8033065be3a76f2059d Mon Sep 17 00:00:00 2001
From: Yoshinori Okuji <yo@nexedi.com>
Date: Sat, 28 Nov 2009 20:16:51 +0000
Subject: [PATCH] Import hash algorithms from hashlib, if possible.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30908 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/Utils.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/product/ERP5Type/Utils.py b/product/ERP5Type/Utils.py
index ed7f58b977..9a282f9d9c 100644
--- a/product/ERP5Type/Utils.py
+++ b/product/ERP5Type/Utils.py
@@ -33,8 +33,14 @@ import re
 import string
 import time
 import warnings
-from md5 import new as md5_new
-from sha import new as sha_new
+try:
+  # Python 2.5 or later
+  from hashlib import md5 as md5_new
+  from hashlib import sha1 as sha_new
+except ImportError:
+  # Python 2.4
+  from md5 import new as md5_new
+  from sha import new as sha_new
 
 from zope.interface import implementedBy
 
-- 
2.30.9