[Erp5-report] r22467 - /erp5/trunk/products/ERP5/Document/Alarm.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Jul 15 11:45:30 CEST 2008
Author: vincent
Date: Tue Jul 15 11:45:28 2008
New Revision: 22467
URL: http://svn.erp5.org?rev=22467&view=rev
Log:
Make "notify" use "real" latest alarm report (it would be implicitely considered as incomplete since the alarm is still running).
Make sure consistent alarm report is used in "notify".
Modified:
erp5/trunk/products/ERP5/Document/Alarm.py
Modified: erp5/trunk/products/ERP5/Document/Alarm.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Alarm.py?rev=22467&r1=22466&r2=22467&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Alarm.py (original)
+++ erp5/trunk/products/ERP5/Document/Alarm.py Tue Jul 15 11:45:28 2008
@@ -434,7 +434,10 @@
notification_mode = self.getAlarmNotificationMode()
if notification_mode == 'never':
return
- if self.sense():
+ # Grab real latest result. Otherwise, we wuld chack n-1 execution as n is
+ # still considered running, and its result would be skipped.
+ active_process = self.getLastActiveProcess(include_active=True)
+ if self.sense(process=active_process):
prefix = 'ERROR'
else:
if notification_mode != 'always':
@@ -444,7 +447,7 @@
candidate_list = self.getDestinationValueList()
if not candidate_list:
candidate_list = None
- result_list = [x for x in self.getLastActiveProcess().getResultList() if x is not None]
+ result_list = [x for x in active_process.getResultList() if x is not None]
attachment_list = []
if len(result_list):
def sort_result_list(a, b):
@@ -475,12 +478,15 @@
attachment_list=attachment_list)
security.declareProtected(Permissions.View, 'getLastActiveProcess')
- def getLastActiveProcess(self):
+ def getLastActiveProcess(self, include_active=False):
"""
This returns the last active process finished. So it will
not returns the current one
"""
- limit = self.isActive() and 2 or 1
+ if include_active:
+ limit = 1
+ else:
+ limit = self.isActive() and 2 or 1
active_process_list = self.getPortalObject().portal_catalog(
portal_type='Active Process', limit=limit,
sort_on=(('creation_date', 'DESC'), ),
More information about the Erp5-report
mailing list