changeset 529:0eea48bd3ad6

handling md5 import for py2.4
author catherine.devlin@gmail.com
date Tue, 01 Feb 2011 19:16:33 -0500
parents 539c11ad1b7e
children 853b9e675dd7
files sqlpython/sqlpyPlus.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/sqlpython/sqlpyPlus.py	Mon Jan 31 19:56:25 2011 -0500
+++ b/sqlpython/sqlpyPlus.py	Tue Feb 01 19:16:33 2011 -0500
@@ -24,7 +24,11 @@
 - catherinedevlin.blogspot.com  May 31, 2006
 """
 import sys, os, re, sqlpython, pyparsing, re, completion
-import datetime, pickle, binascii, subprocess, time, itertools, hashlib
+import datetime, pickle, binascii, subprocess, time, itertools
+try:
+    from hashlib import md5
+except ImportError:
+    from md5 import new as md5
 import traceback, operator
 from cmd2 import Cmd, make_option, options, Statekeeper, Cmd2TestCase, options_defined
 import operator
@@ -236,7 +240,7 @@
         self.url = ''
         if under_limit:
             self.blob = blob.read()
-            self.hashed = hashlib.md5(self.blob).hexdigest()
+            self.hashed = md5(self.blob).hexdigest()
             self.extension = imagedetect.extension_from_data(self.blob)
             if self.folder_ok():
                 self.file_name = '%s/%s%s' % (