[Zodb-checkins] SVN: ZODB/trunk/src/ZODB/scripts/fstail.py Got rid of a deprecation warning on Python 2.6.

Jim Fulton jim at zope.com
Mon May 4 12:49:51 EDT 2009


Log message for revision 99726:
  Got rid of a deprecation warning on Python 2.6.
  

Changed:
  U   ZODB/trunk/src/ZODB/scripts/fstail.py

-=-
Modified: ZODB/trunk/src/ZODB/scripts/fstail.py
===================================================================
--- ZODB/trunk/src/ZODB/scripts/fstail.py	2009-05-04 16:14:55 UTC (rev 99725)
+++ ZODB/trunk/src/ZODB/scripts/fstail.py	2009-05-04 16:49:50 UTC (rev 99726)
@@ -19,16 +19,20 @@
 
 import binascii
 import getopt
-import sha
 import sys
 
+try:
+    from hashlib import sha1
+except ImportError:
+    from sha import sha as sha1
+
 def main(path, ntxn):
     f = open(path, "rb")
     f.seek(0, 2)
     th = prev_txn(f)
     i = ntxn
     while th and i > 0:
-        hash = sha.sha(th.get_raw_data()).digest()
+        hash = sha1(th.get_raw_data()).digest()
         l = len(str(th.get_timestamp())) + 1
         th.read_meta()
         print "%s: hash=%s" % (th.get_timestamp(),
@@ -47,7 +51,6 @@
         if k == '-n':
             ntxn = int(v)
     main(path, ntxn)
-    
 
 if __name__ == "__main__":
     Main()



More information about the Zodb-checkins mailing list