| Index: static/upload.py
 | 
| ===================================================================
 | 
| --- static/upload.py	(revision 412)
 | 
| +++ static/upload.py	(working copy)
 | 
| @@ -33,8 +33,14 @@
 | 
|  
 | 
|  import cookielib
 | 
|  import getpass
 | 
| +# Work-around for md5 module deprecation warning in python 2.5+:
 | 
| +try: 
 | 
| +  import hashlib # Try to load hashlib (python 2.5+)
 | 
| +except ImportError:  # If it cannot be imported, set it to None
 | 
| +  hashlib = None
 | 
|  import logging
 | 
| -import md5
 | 
| +if not hashlib: # If hashlib was not imported, then this is python 2.4: use md5
 | 
| +  import md5
 | 
|  import mimetypes
 | 
|  import optparse
 | 
|  import os
 | 
| @@ -674,7 +680,10 @@
 | 
|                 (type, filename))
 | 
|          file_too_large = True
 | 
|          content = ""
 | 
| -      checksum = md5.new(content).hexdigest()
 | 
| +      if hashlib: # python 2.5+ uses hashlib
 | 
| +        checksum = hashlib.md5(content).hexdigest()
 | 
| +      else:       # python 2.4- uses md5
 | 
| +        checksum = md5.new(content).hexdigest()
 | 
|        if options.verbose > 0 and not file_too_large:
 | 
|          print "Uploading %s file for %s" % (type, filename)
 | 
|        url = "/%d/upload_content/%d/%d" % (int(issue), int(patchset), file_id)
 | 
| @@ -1326,7 +1335,10 @@
 | 
|    base_hashes = ""
 | 
|    for file, info in files.iteritems():
 | 
|      if not info[0] is None:
 | 
| -      checksum = md5.new(info[0]).hexdigest()
 | 
| +      if hashlib: # python 2.5+ uses hashlib
 | 
| +        checksum = hashlib.md5(info[0]).hexdigest()
 | 
| +      else:       # python 2.4- uses md5
 | 
| +        checksum = md5.new(info[0]).hexdigest()
 | 
|        if base_hashes:
 | 
|          base_hashes += "|"
 | 
|        base_hashes += checksum + ":" + file
 | 
| 
 |