fam örneğinde olduğu gibi bazen Content-Length alınamıyor. Bu durumda

hata verip çıkmak yanlış.
This commit is contained in:
Barış Metin
2005-06-29 22:53:34 +00:00
parent 3b13b79689
commit 004c25e360
+4 -1
View File
@@ -129,7 +129,7 @@ class Fetcher:
self.err(('(%s): %s') % (e.__class__.__name__, e))
if not headers is None and not headers.has_key('Content-Length'):
self.err('file not found')
totalsize = 0 # could not get the totalsize of file
else: totalsize = int(headers['Content-Length'])
dest = open(self.filedest + "/" + self.url.filename() , "w")
@@ -145,6 +145,9 @@ class Progress:
self.percent = 0
def update(self, size):
if not self.totalsize:
return 100
percent = (size * 100) / self.totalsize
if percent and self.percent is not percent:
self.percent = percent