> Please find attached a new backends.py file and a patch against CVS HEAD:
> - use self.ftp.quit() in self.close()
> - use close() in connect() and only "pass" for ftplib.all_errors exceptions
> - Log FTP command in the retry-loop - so the used comment gets logged
> also when retrying
> - Optimized "nlst" check
> - Removed handling of 221/421 errors - this should get handled now in
> general
> - Whitespace fixes for log.FatalError; also print stack with the last one
> - Do not sleep on the first retry: this avoids a 10 seconds delay on
> e.g. EOFError
> - Just call connect() if we expect to be logged in; moved this out of
> the try block
>
> The main fix probably is: call connect() on errors, if is_connected -
> this means: we expect to be connected.
> As connect() now disconnects/quits first, this should fix the "too
> many logins" issue found recently - and which had been fixed by you in
> some other way.
> Also the "only sleep 0 seconds on first exception" change is a good
> one: we should not wait before re-trying the first time.
>
> There are also some TEST and TODO comments. Please review either the
> patch and apply it as you think it fits. I would just drop the TEST
> comment, which is mainly a hint for testing the backend also with a
> good connection ;)
OK, this will work, but I have philosophical problems with handling all
errors with a sledge hammer, however, as funky as FTP is implemented in
general, this may work out to be the best solution.