002503: Change md5 module by hashlib.

Fallback to md5 on importerror (python 2.4 users)


svn: r11420
This commit is contained in:
Benny Malengier
2008-12-04 21:44:12 +00:00
parent 4fe006e575
commit 4bf3182972
4 changed files with 20 additions and 8 deletions

View File

@@ -28,7 +28,10 @@ Handles generation and access to thumbnails used in GRAMPS.
#
#-------------------------------------------------------------------------
import os
import md5
try:
from hashlib import md5
except ImportError:
from md5 import md5
#-------------------------------------------------------------------------
#
@@ -123,7 +126,7 @@ def __build_thumb_path(path, rectangle=None):
extra = ""
if rectangle is not None:
extra = "?" + str(rectangle)
md5_hash = md5.md5(path+extra)
md5_hash = md5(path+extra)
return os.path.join(const.THUMB_DIR, md5_hash.hexdigest()+'.png')
#-------------------------------------------------------------------------