Comment 1 for bug 244605

Revision history for this message
David Smid (dsmid) wrote :

I'd like to fix this bug but don't know how to do it right.

Apparently, I can use this to silence the error:

    def setSubDone(self, subkey):
...
            if not subkey in self.__subprogress:
                return
...

or:
...
           (subcurrent, subtotal,
             fragment, subdata) = self.__subprogress.setdefault(subkey, (0, 0, 0, {}))
...

But I feel the cause of this error is elsewhere, maybe in Fetcher.run(), where item.setNextURL() is called.
FetcherItem.setNextURL calls self._urlobj.set() with next mirror URL and that sets also self._urlobj.original to given URL (why ???).
But self._urlobj.original is passed as a parameter to Progress.setSubDone() and there it's used as a key in __subprogress dictionary.
If FetcherItem.__progress.setSubDone() is called before calling FetcherItem.progress() or FetcherItem.updateSpeed(), the dictionary item with key self._urlobj.original is not created and KeyError is thrown.

Does it make sense or am I missing anything ?