002503: Change md5 module by hashlib.
Fallback to md5 on importerror (python 2.4 users) svn: r11420
This commit is contained in:
parent
4fe006e575
commit
4bf3182972
@ -28,7 +28,10 @@ Handles generation and access to thumbnails used in GRAMPS.
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import os
|
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 = ""
|
extra = ""
|
||||||
if rectangle is not None:
|
if rectangle is not None:
|
||||||
extra = "?" + str(rectangle)
|
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')
|
return os.path.join(const.THUMB_DIR, md5_hash.hexdigest()+'.png')
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
@ -28,7 +28,10 @@
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import os
|
import os
|
||||||
import md5
|
try:
|
||||||
|
from hashlib import md5
|
||||||
|
except ImportError:
|
||||||
|
from md5 import md5
|
||||||
import zipfile
|
import zipfile
|
||||||
import time
|
import time
|
||||||
import locale
|
import locale
|
||||||
@ -452,7 +455,7 @@ class ODFDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
|
|||||||
act_width = x_cm/ratio
|
act_width = x_cm/ratio
|
||||||
|
|
||||||
not_extension, extension = os.path.splitext(file_name)
|
not_extension, extension = os.path.splitext(file_name)
|
||||||
odf_name = md5.new(file_name).hexdigest() + extension
|
odf_name = md5(file_name).hexdigest() + extension
|
||||||
|
|
||||||
media_list_item = (file_name, odf_name)
|
media_list_item = (file_name, odf_name)
|
||||||
if not media_list_item in self.media_list:
|
if not media_list_item in self.media_list:
|
||||||
|
@ -45,7 +45,10 @@ Narrative Web Page generator.
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import md5
|
try:
|
||||||
|
from hashlib import md5
|
||||||
|
except ImportError:
|
||||||
|
from md5 import md5
|
||||||
import time
|
import time
|
||||||
import locale
|
import locale
|
||||||
import shutil
|
import shutil
|
||||||
@ -236,7 +239,7 @@ def html_escape(text):
|
|||||||
|
|
||||||
def name_to_md5(text):
|
def name_to_md5(text):
|
||||||
"""This creates an MD5 hex string to be used as filename."""
|
"""This creates an MD5 hex string to be used as filename."""
|
||||||
return md5.new(text).hexdigest()
|
return md5(text).hexdigest()
|
||||||
|
|
||||||
|
|
||||||
class BasePage:
|
class BasePage:
|
||||||
|
@ -33,7 +33,10 @@ This is the research tool, not the low-level data ingerity check.
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import os
|
import os
|
||||||
import cPickle
|
import cPickle
|
||||||
import md5
|
try:
|
||||||
|
from hashlib import md5
|
||||||
|
except ImportError:
|
||||||
|
from md5 import md5
|
||||||
import Errors
|
import Errors
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
@ -558,7 +561,7 @@ class VerifyResults(ManagedWindow):
|
|||||||
self.window_shown = False
|
self.window_shown = False
|
||||||
|
|
||||||
def load_ignored(self,db_filename):
|
def load_ignored(self,db_filename):
|
||||||
md5sum = md5.md5(db_filename)
|
md5sum = md5(db_filename)
|
||||||
self.ignores_filename = os.path.join(
|
self.ignores_filename = os.path.join(
|
||||||
const.HOME_DIR,md5sum.hexdigest() + os.path.extsep + 'vfm')
|
const.HOME_DIR,md5sum.hexdigest() + os.path.extsep + 'vfm')
|
||||||
if not self._load_ignored(self.ignores_filename):
|
if not self._load_ignored(self.ignores_filename):
|
||||||
|
Loading…
Reference in New Issue
Block a user