diff --git a/debian/changelog b/debian/changelog index 8aeb5f3..b8041d7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,8 +18,9 @@ ubuntu-dev-tools (0.137) UNRELEASED; urgency=low [ Andreas Moog ] * sponsor-patch: Check permission to unsubscribe sponsors-team (LP: #896884) + * requestsync: Give user option to retry in case of temporary error (LP: #850360) - -- Andreas Moog Sun, 27 Nov 2011 16:47:05 +0100 + -- Andreas Moog Sun, 27 Nov 2011 22:13:22 +0100 ubuntu-dev-tools (0.136) unstable; urgency=low diff --git a/ubuntutools/requestsync/mail.py b/ubuntutools/requestsync/mail.py index c6607d6..4708b7a 100644 --- a/ubuntutools/requestsync/mail.py +++ b/ubuntutools/requestsync/mail.py @@ -163,13 +163,20 @@ Content-Type: text/plain; charset=UTF-8 confirmation_prompt() # connect to the server - try: - Logger.info('Connecting to %s:%s ...', mailserver_host, mailserver_port) - s = smtplib.SMTP(mailserver_host, mailserver_port) - except socket.error, s: - Logger.error('Could not connect to %s:%s: %s (%i)', - mailserver_host, mailserver_port, s[1], s[0]) - return + while True: + try: + Logger.info('Connecting to %s:%s ...', mailserver_host, mailserver_port) + s = smtplib.SMTP(mailserver_host, mailserver_port) + break + except socket.error, s: + Logger.error('Could not connect to %s:%s: %s (%i)', + mailserver_host, mailserver_port, s[1], s[0]) + return + except smtplib.SMTPConnectError, s: + Logger.error('Could not connect to %s:%s: %s (%i)', + mailserver_host, mailserver_port, s[1], s[0]) + if s[0] == 421: + confirmation_prompt(message="This is a temporary error, press [Enter] to retry. Press [Ctrl-C] to abort now.") if mailserver_user and mailserver_pass: try: