Complete.Org: Mailing Lists: Archives: offlineimap: December 2008:
[PATCH] Fixing md5 import when hashlib is available
Home

[PATCH] Fixing md5 import when hashlib is available

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [PATCH] Fixing md5 import when hashlib is available
From: Paul Hinze <paul.t.hinze@xxxxxxxxx>
Date: Mon, 22 Dec 2008 18:42:44 -0600

Thanks to habnabit and Rhamphoryncus in #python for help debugging
---
 offlineimap/folder/Maildir.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/offlineimap/folder/Maildir.py b/offlineimap/folder/Maildir.py
index d1d5077..937500f 100644
--- a/offlineimap/folder/Maildir.py
+++ b/offlineimap/folder/Maildir.py
@@ -25,7 +25,7 @@ from threading import Lock
 try:
     from hashlib import md5
 except ImportError:
-    import md5
+    from md5 import md5
 
 uidmatchre = re.compile(',U=(\d+)')
 flagmatchre = re.compile(':.*2,([A-Z]+)')
@@ -84,7 +84,7 @@ class MaildirFolder(BaseFolder):
         files = []
         nouidcounter = -1               # Messages without UIDs get
                                         # negative UID numbers.
-        foldermd5 = md5.new(self.getvisiblename()).hexdigest()
+        foldermd5 = md5(self.getvisiblename()).hexdigest()
         folderstr = ',FMD5=' + foldermd5
         for dirannex in ['new', 'cur']:
             fulldirname = os.path.join(self.getfullname(), dirannex)
@@ -177,7 +177,7 @@ class MaildirFolder(BaseFolder):
                            os.getpid(),
                            socket.gethostname(),
                            uid,
-                           md5.new(self.getvisiblename()).hexdigest())
+                           md5(self.getvisiblename()).hexdigest())
             if os.path.exists(os.path.join(tmpdir, messagename)):
                 time.sleep(2)
                 attempts += 1
-- 
1.5.6.3




[Prev in Thread] Current Thread [Next in Thread]
  • [PATCH] Fixing md5 import when hashlib is available, Paul Hinze <=