[Yum-devel] [PATCH 2/2] add URLGrabError.code to the external downloader API

James Antill james at fedoraproject.org
Tue Apr 16 13:56:33 UTC 2013


On Tue, 2013-04-16 at 14:20 +0200, Zdenek Pavlas wrote:
> ---
>  scripts/urlgrabber-ext-down | 2 +-
>  urlgrabber/grabber.py       | 5 +++--
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/urlgrabber-ext-down b/scripts/urlgrabber-ext-down
> index 3dafb12..9ea0e70 100755
> --- a/scripts/urlgrabber-ext-down
> +++ b/scripts/urlgrabber-ext-down
> @@ -68,7 +68,7 @@ def main():
>                  ug_err = 'OK'
>              except URLGrabError, e:
>                  size = 0
> -                ug_err = '%d %s' % e.args
> +                ug_err = '%d %d %s' % (e.errno, getattr(e, 'code', 0), e.strerror)
>              write('%d %d %d %.3f %s\n', opts._id, size, dlsz, dltm, ug_err)
>  
>  if __name__ == '__main__':
> diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py
> index 9526dc1..66a1cf6 100644
> --- a/urlgrabber/grabber.py
> +++ b/urlgrabber/grabber.py
> @@ -2052,7 +2052,7 @@ class _ExternalDownloader:
>              raise KeyboardInterrupt
>          for line in lines:
>              # parse downloader output
> -            line = line.split(' ', 5)
> +            line = line.split(' ', 6)
>              _id, size = map(int, line[:2])
>              if len(line) == 2:
>                  self.running[_id]._progress.update(size)
> @@ -2063,7 +2063,8 @@ class _ExternalDownloader:
>                  ug_err = None
>                  if DEBUG: DEBUG.info('success')
>              else:
> -                ug_err = URLGrabError(int(line[4]), line[5])
> +                ug_err = URLGrabError(int(line[4]), line[6])
> +                ug_err.code = int(line[5])

 Do we want to set this when it's 0? AIUI previously the API has been if
the attribute is set, then it's valid.

 Otherwise, ACK.



More information about the Yum-devel mailing list