1
0
Fork 0

Avoid deprecation warning introduced in Python-2.6.

This commit is contained in:
Witold Filipczyk 2008-12-06 18:07:07 +01:00 committed by Witold Filipczyk
parent 5755137630
commit 90779b1985
1 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,10 @@
#!/usr/bin/env python
import md5
HAS_HASHLIB = False
try:
import hashlib
HAS_HASHLIB = True
except:
import md5
import cgi
print "Content-Type: text/plain\r\n"
@ -8,7 +13,10 @@ if form.has_key("file"):
plik = form["file"]
length = 0
if plik.file:
dig = md5.new()
if HAS_HASHLIB:
dig = hashlib.md5()
else:
dig = md5.new()
while 1:
data = plik.file.read(1000000)
if not data: