Commit 2d37f785 authored by Vincent Pelletier's avatar Vincent Pelletier

Make "notify" only use most recent (considered incomplete) alarm result if it...

Make "notify" only use most recent (considered incomplete) alarm result if it is started as an activity, so it can also be invoked by hand to generate a result of a completed alarm run.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22471 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4a72039f
...@@ -317,7 +317,7 @@ class Alarm(XMLObject, PeriodicityMixin): ...@@ -317,7 +317,7 @@ class Alarm(XMLObject, PeriodicityMixin):
# Old API # Old API
getattr(self.activate(tag=tag), method_id)() getattr(self.activate(tag=tag), method_id)()
if self.isAlarmNotificationMode(): if self.isAlarmNotificationMode():
self.activate(after_tag=tag).notify() self.activate(after_tag=tag).notify(include_active=True)
security.declareProtected(Permissions.ModifyPortalContent, 'sense') security.declareProtected(Permissions.ModifyPortalContent, 'sense')
def sense(self, process=None): def sense(self, process=None):
...@@ -424,7 +424,7 @@ class Alarm(XMLObject, PeriodicityMixin): ...@@ -424,7 +424,7 @@ class Alarm(XMLObject, PeriodicityMixin):
return self.activeSense(fixit=1) return self.activeSense(fixit=1)
security.declareProtected(Permissions.ModifyPortalContent, 'notify') security.declareProtected(Permissions.ModifyPortalContent, 'notify')
def notify(self): def notify(self, include_active=False):
""" """
This method is called to notify people that some alarm has This method is called to notify people that some alarm has
been sensed. Notification consists of sending an email been sensed. Notification consists of sending an email
...@@ -436,7 +436,7 @@ class Alarm(XMLObject, PeriodicityMixin): ...@@ -436,7 +436,7 @@ class Alarm(XMLObject, PeriodicityMixin):
return return
# Grab real latest result. Otherwise, we would check n-1 execution as n is # Grab real latest result. Otherwise, we would check n-1 execution as n is
# still considered running, and its result would be skipped. # still considered running, and its result would be skipped.
active_process = self.getLastActiveProcess(include_active=True) active_process = self.getLastActiveProcess(include_active=include_active)
if self.sense(process=active_process): if self.sense(process=active_process):
prefix = 'ERROR' prefix = 'ERROR'
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment