diff --git a/product/ERP5/Tool/NotificationTool.py b/product/ERP5/Tool/NotificationTool.py index be376565e445c2c577f4ece3285678204253e694..db0b2305927ab2859fa3a50ea38c98b2976373c9 100644 --- a/product/ERP5/Tool/NotificationTool.py +++ b/product/ERP5/Tool/NotificationTool.py @@ -321,10 +321,8 @@ class NotificationTool(BaseTool): person_value = catalog_tool.getResultValue(portal_type=portal_type_list, reference=person) if person_value is None: - # For backward compatibility. I recommend to use ValueError.(yusei) - raise IndexError, "Can't find person document which reference is '%s'" % person - else: - person = person_value + raise ValueError("Can't find person document which reference is '%s'" % person) + person = person_value to_person_list.append(person) # prepare low-level arguments if needed. diff --git a/product/ERP5/tests/testNotificationTool.py b/product/ERP5/tests/testNotificationTool.py index fef16abe8aae32c7a3a6f0c707c3cd4484cba6bf..5d0aec467f40d46f31512553c0e18f2380460af3 100644 --- a/product/ERP5/tests/testNotificationTool.py +++ b/product/ERP5/tests/testNotificationTool.py @@ -384,11 +384,9 @@ class TestNotificationTool(ERP5TypeTestCase): sequence_list.play(self) def test_09_InvalideRecipient(self): - self.assertRaises( - IndexError, - self.portal.portal_notifications.sendMessage, - recipient='UnknowUser', subject='Subject', message='Message' - ) + with self.assertRaises(ValueError): + self.portal.portal_notifications.sendMessage( + recipient='UnknowUser', subject='Subject', message='Message') def stepCheckPersonNotification(self, sequence=None, sequence_list=None, **kw):