summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/test-012-wallace_invitationpolicy.py1
-rw-r--r--wallace/module_invitationpolicy.py10
2 files changed, 9 insertions, 2 deletions
diff --git a/tests/unit/test-012-wallace_invitationpolicy.py b/tests/unit/test-012-wallace_invitationpolicy.py
index b612a52..189f3c6 100644
--- a/tests/unit/test-012-wallace_invitationpolicy.py
+++ b/tests/unit/test-012-wallace_invitationpolicy.py
@@ -104,6 +104,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
def _mock_smtp_sendmail(self, from_addr, to_addr, message, mail_options=None, rcpt_options=None):
self.smtplog.append((from_addr, to_addr, message))
+ return True
def test_001_itip_events_from_message(self):
itips = pykolab.itip.events_from_message(message_from_string(itip_multipart))
diff --git a/wallace/module_invitationpolicy.py b/wallace/module_invitationpolicy.py
index edd23a9..f401b0d 100644
--- a/wallace/module_invitationpolicy.py
+++ b/wallace/module_invitationpolicy.py
@@ -1209,15 +1209,21 @@ def send_update_notification(object, receiving_user, old=None, reply=True):
smtp.set_debuglevel(True)
success = False
+ retries = 5
- while not success:
+ while not success and retries > 0:
try:
success = smtp.sendmail(orgemail, receiving_user['mail'], msg.as_string())
log.debug(_("Sent update notification to %r: %r") % (receiving_user['mail'], success), level=8)
smtp.quit()
+ break
except Exception, e:
log.error(_("SMTP sendmail error: %r") % (e))
- time.sleep(10)
+
+ time.sleep(10)
+ retries -= 1
+
+ return success
def send_cancel_notification(object, receiving_user, deleted=False):