]> code.delx.au - offlineimap/commitdiff
Import md5 from hashlib if available.
authorLoui Chang <louipc.ist@gmail.com>
Thu, 4 Dec 2008 21:45:15 +0000 (16:45 -0500)
committerJohn Goerzen <jgoerzen@complete.org>
Thu, 11 Dec 2008 06:28:09 +0000 (00:28 -0600)
The md5 module is deprecated and hashlib is available
since python 2.5.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
offlineimap/folder/Maildir.py

index d1921b88b03ece0c9f27a1be2809a79b7258105e..d1d5077a903a35e23000be270446378e5ae23f52 100644 (file)
 #    along with this program; if not, write to the Free Software
 #    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
 #    along with this program; if not, write to the Free Software
 #    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
+import os.path, os, re, time, socket
 from Base import BaseFolder
 from offlineimap import imaputil
 from offlineimap.ui import UIBase
 from threading import Lock
 from Base import BaseFolder
 from offlineimap import imaputil
 from offlineimap.ui import UIBase
 from threading import Lock
-import os.path, os, re, time, socket, md5
+
+try:
+    from hashlib import md5
+except ImportError:
+    import md5
 
 uidmatchre = re.compile(',U=(\d+)')
 flagmatchre = re.compile(':.*2,([A-Z]+)')
 
 uidmatchre = re.compile(',U=(\d+)')
 flagmatchre = re.compile(':.*2,([A-Z]+)')