0002503: Change md5 module by hashlib
Fallback to md5 if importerror svn: r11419
This commit is contained in:
parent
9326cc9516
commit
f1d117f200
@ -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 != 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')
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -28,7 +28,10 @@
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
import md5
|
||||
try:
|
||||
from hashlib import md5
|
||||
except ImportError:
|
||||
from md5 import md5
|
||||
import zipfile
|
||||
import time
|
||||
import locale
|
||||
@ -452,7 +455,7 @@ class ODFDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
|
||||
act_width = x_cm/ratio
|
||||
|
||||
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)
|
||||
if not media_list_item in self.media_list:
|
||||
|
@ -34,7 +34,10 @@ Narrative Web Page generator.
|
||||
#------------------------------------------------------------------------
|
||||
import cgi
|
||||
import os
|
||||
import md5
|
||||
try:
|
||||
from hashlib import md5
|
||||
except ImportError:
|
||||
from md5 import md5
|
||||
import time
|
||||
import locale
|
||||
import shutil
|
||||
@ -325,7 +328,7 @@ class BasePage:
|
||||
of.close()
|
||||
|
||||
def lnkfmt(self,text):
|
||||
return md5.new(text).hexdigest()
|
||||
return md5(text).hexdigest()
|
||||
|
||||
def display_footer(self, of,db):
|
||||
of.write('</div>\n\n')
|
||||
@ -976,7 +979,7 @@ class SurnamePage(BasePage):
|
||||
|
||||
BasePage.__init__(self, title, options, archive, media_list, "")
|
||||
|
||||
of = self.create_link_file(md5.new(title).hexdigest(),'srn')
|
||||
of = self.create_link_file(md5(title).hexdigest(),'srn')
|
||||
self.display_header(of,db,title,get_researcher().get_name(),True)
|
||||
|
||||
msg = _("This page contains an index of all the individuals in the "
|
||||
|
@ -32,7 +32,10 @@ This is the research tool, not the low-level data ingerity check.
|
||||
#------------------------------------------------------------------------
|
||||
import os
|
||||
import cPickle
|
||||
import md5
|
||||
try:
|
||||
from hashlib import md5
|
||||
except ImportError:
|
||||
from md5 import md5
|
||||
import Errors
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -551,7 +554,7 @@ class VerifyResults(ManagedWindow):
|
||||
self.window_shown = False
|
||||
|
||||
def load_ignored(self,db_filename):
|
||||
md5sum = md5.md5(db_filename)
|
||||
md5sum = md5(db_filename)
|
||||
self.ignores_filename = os.path.join(
|
||||
const.HOME_DIR,md5sum.hexdigest() + os.path.extsep + 'vfm')
|
||||
if not self._load_ignored(self.ignores_filename):
|
||||
|
Loading…
Reference in New Issue
Block a user