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

extras-buildsys/common FileDownloader.py,1.7,1.8



Author: dcbw

Update of /cvs/fedora/extras-buildsys/common
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv10409/common

Modified Files:
	FileDownloader.py 
Log Message:
2005-06-21  Dan Williams <dcbw redhat com>

    * common/FileDownloader.py
        - Trap more errors, simplify code a bit




Index: FileDownloader.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/common/FileDownloader.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- FileDownloader.py	19 Jun 2005 04:13:26 -0000	1.7
+++ FileDownloader.py	21 Jun 2005 17:54:58 -0000	1.8
@@ -20,6 +20,7 @@
 import urllib
 import string
 import os
+import socket
 import HTTPSURLopener
 from M2Crypto import SSL
 import CommonErrors
@@ -86,23 +87,23 @@
         threading.Thread.__init__(self)
 
     def run(self):
-        success = False
+        result = None
         if self._url and self._target_dir and self._filename:
             if not os.path.exists(self._target_dir):
                 os.makedirs(self._target_dir)
             os.chdir(self._target_dir)
             target_file = os.path.join(self._target_dir, self._filename)
-            result = None
             try:
                 result = self._opener.retrieve(self._url, target_file)
             except SSL.SSLError, e:
                 # Don't traceback on dropped connections or timeouts
                 if CommonErrors.canIgnoreSSLError(e):
-                    result = None
-            if result:
-                success = True
+                    pass
+            except socket.error, e:
+                if CommonErrors.canIgnoreSocketError(e):
+                    pass
 
-        if success:
+        if result:
             self._callback('done', self._cb_data)
         else:
             self._callback('failed', self._cb_data)


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