--- a/src/pyams_scheduler/task.py Tue Mar 17 16:09:59 2015 +0100
+++ b/src/pyams_scheduler/task.py Fri Mar 20 17:11:26 2015 +0100
@@ -9,7 +9,6 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
-from zope.lifecycleevent.interfaces import IObjectRemovedEvent, IObjectAddedEvent, IObjectModifiedEvent
__docformat__ = 'restructuredtext'
@@ -30,7 +29,9 @@
from pyramid_mailer.interfaces import IMailer
from transaction.interfaces import ITransactionManager
from zope.component.interfaces import ISite
+from zope.interface.interfaces import ComponentLookupError
from zope.intid.interfaces import IIntIds
+from zope.lifecycleevent.interfaces import IObjectRemovedEvent, IObjectAddedEvent, IObjectModifiedEvent
# import packages
import transaction
@@ -48,7 +49,6 @@
from zope.container.contained import Contained
from zope.container.folder import Folder
from zope.interface import implementer, alsoProvides, noLongerProvides
-from zope.lifecycleevent import ObjectRemovedEvent, ObjectModifiedEvent
from zope.location import locate
from zope.schema.fieldproperty import FieldProperty
@@ -319,7 +319,9 @@
self.check_history()
def send_report(self, report, status, registry):
- if not self.__parent__.report_mailer:
+ try:
+ mailer_name = self.__parent__.report_mailer
+ except (TypeError, ComponentLookupError):
return
if ((status == 'Empty') and not self.send_empty_reports) or \
((status == 'OK') and self.report_errors_only):
@@ -329,7 +331,7 @@
message_target = self.errors_target or message_target
if not message_target:
return
- mailer = registry.queryUtility(IMailer, self.__parent__.report_mailer)
+ mailer = registry.queryUtility(IMailer, mailer_name)
if mailer is not None:
report_source = self.__parent__.report_source
if status == 'Error':