[yum-commits] urlgrabber/grabber.py

skvidal at osuosl.org skvidal at osuosl.org
Wed Aug 5 13:50:19 UTC 2009


 urlgrabber/grabber.py |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 353f301494eae2793dfe759dacf951274950b88a
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Wed Aug 5 09:47:46 2009 -0400

    - make sure we tell pycurl to get the filetime when downloading
    - set a couple of options as 'True/False' instead of 1,0 - for readability
    - make sure the option passed to timeout is an int - not a string

diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py
index 05af261..be5d43b 100644
--- a/urlgrabber/grabber.py
+++ b/urlgrabber/grabber.py
@@ -1528,11 +1528,12 @@ class PyCurlFileObject():
 
 
         # defaults we're always going to set
-        self.curl_obj.setopt(pycurl.NOPROGRESS, 0)
+        self.curl_obj.setopt(pycurl.NOPROGRESS, False)
         self.curl_obj.setopt(pycurl.WRITEFUNCTION, self._retrieve)
         self.curl_obj.setopt(pycurl.HEADERFUNCTION, self._hdr_retrieve)
         self.curl_obj.setopt(pycurl.PROGRESSFUNCTION, self._progress_update)
-        self.curl_obj.setopt(pycurl.FAILONERROR, 1)
+        self.curl_obj.setopt(pycurl.FAILONERROR, True)
+        self.curl_obj.setopt(pycurl.OPT_FILETIME, True)
         
         if DEBUG:
             self.curl_obj.setopt(pycurl.VERBOSE, True)
@@ -1540,13 +1541,13 @@ class PyCurlFileObject():
             self.curl_obj.setopt(pycurl.USERAGENT, opts.user_agent)
         
         # maybe to be options later
-        self.curl_obj.setopt(pycurl.FOLLOWLOCATION, 1)
+        self.curl_obj.setopt(pycurl.FOLLOWLOCATION, True)
         self.curl_obj.setopt(pycurl.MAXREDIRS, 5)
         
         # timeouts
         timeout = 300
         if opts.timeout:
-            timeout = opts.timeout
+            timeout = int(opts.timeout)
             self.curl_obj.setopt(pycurl.CONNECTTIMEOUT, timeout)
 
         # ssl options


More information about the Yum-commits mailing list