requestsync: Give user option to retry in case of temporary error (LP: #850360)

This commit is contained in:
Andreas Moog 2011-11-27 22:14:05 +01:00
parent 73843307f0
commit 677e1b8e4e
2 changed files with 16 additions and 8 deletions

3
debian/changelog vendored
View File

@ -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 <amoog@ubuntu.com> Sun, 27 Nov 2011 16:47:05 +0100
-- Andreas Moog <amoog@ubuntu.com> Sun, 27 Nov 2011 22:13:22 +0100
ubuntu-dev-tools (0.136) unstable; urgency=low

View File

@ -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: