From 87ca825ae13b8733fcf0dc61d6c15b70b1b0c1c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 31 May 2013 11:26:06 +0200 Subject: [PATCH] [IMP] auth_signup: now manage assertionerror, especially when having a login / email that is not valid. bzr revid: tde@openerp.com-20130531092606-q2gwhtd8j2lva3yo --- addons/auth_signup/res_users.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/auth_signup/res_users.py b/addons/auth_signup/res_users.py index fe5ff7b59c7..340865045aa 100644 --- a/addons/auth_signup/res_users.py +++ b/addons/auth_signup/res_users.py @@ -270,6 +270,13 @@ class res_users(osv.Model): raise osv.except_osv(_("Cannot send email: user has no email address."), user.name) try: self.pool.get('email.template').send_mail(cr, uid, template.id, user.id, force_send=True, raise_exception=True, context=context) + except AssertionError as e: + # get the args of the original error, wrap into a value and throw a MailDeliveryException + # that is an except_orm, with name and value as args + value = '. '.join(e.args) + if 'one valid recipient address should be specified' in e.args[0]: + value += '. Please check that the user\'s email address is valid.' + raise MailDeliveryException(_("Mail Delivery Failed"), value) except MailDeliveryException: raise