gnome-doc-utils r1160 - in trunk/xml2po: . modes



Author: claudep
Date: Thu Apr  2 08:05:42 2009
New Revision: 1160
URL: http://svn.gnome.org/viewvc/gnome-doc-utils?rev=1160&view=rev

Log:
2009-04-02  Claude Paroz  <claude 2xlibre net>

	* modes/docbook.py: Use new hashlib module rather than deprecated md5
	module, when available.
	Fixes bug #576161.

Modified:
   trunk/xml2po/ChangeLog
   trunk/xml2po/modes/docbook.py

Modified: trunk/xml2po/modes/docbook.py
==============================================================================
--- trunk/xml2po/modes/docbook.py	(original)
+++ trunk/xml2po/modes/docbook.py	Thu Apr  2 08:05:42 2009
@@ -36,8 +36,12 @@
 import re
 import libxml2
 import os
-import md5
 import sys
+try:
+    # Hashlib is new in Python 2.5
+    from hashlib import md5 as md5_new
+except ImportError:
+    from md5 import new as md5_new
 
 class docbookXmlMode:
     """Class for special handling of DocBook document types.
@@ -109,7 +113,7 @@
         return last
 
     def _md5_for_file(self, filename):
-        hash = md5.new()
+        hash = md5_new()
         input = open(filename, "rb")
         read = input.read(4096)
         while read:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]