[Erp5-report] r30318 - in /erp5/trunk/products/ERP5: Document/Alarm.py PropertySheet/Alarm.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Nov 5 09:42:49 CET 2009
Author: yo
Date: Thu Nov 5 09:42:44 2009
New Revision: 30318
URL: http://svn.erp5.org?rev=30318&view=rev
Log:
Add support for configuring notification by providing a method id. Otherwise, the message is hardcoded, and may not be customized.
Modified:
erp5/trunk/products/ERP5/Document/Alarm.py
erp5/trunk/products/ERP5/PropertySheet/Alarm.py
Modified: erp5/trunk/products/ERP5/Document/Alarm.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Alarm.py?rev=30318&r1=30317&r2=30318&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Alarm.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Alarm.py [utf8] Thu Nov 5 09:42:44 2009
@@ -449,12 +449,23 @@
# Grab real latest result. Otherwise, we would check n-1 execution as n is
# still considered running, and its result would be skipped.
active_process = self.getLastActiveProcess(include_active=include_active)
- if self.sense(process=active_process):
+ sense_result = self.sense(process=active_process)
+ if not sense_result and notification_mode != 'always':
+ return
+
+ # If a notification method is specified explicitly, call it instead of
+ # using the default notification.
+ method_id = self.getNotificationMethodId()
+ if method_id:
+ getattr(self, method_id)(process=active_process,
+ sense_result=sense_result)
+ return
+
+ if sense_result:
prefix = 'ERROR'
else:
- if notification_mode != 'always':
- return
prefix = 'INFO'
+
notification_tool = getToolByName(self, 'portal_notifications')
candidate_list = self.getDestinationValueList()
if not candidate_list:
Modified: erp5/trunk/products/ERP5/PropertySheet/Alarm.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/PropertySheet/Alarm.py?rev=30318&r1=30317&r2=30318&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/PropertySheet/Alarm.py [utf8] (original)
+++ erp5/trunk/products/ERP5/PropertySheet/Alarm.py [utf8] Thu Nov 5 09:42:44 2009
@@ -50,6 +50,10 @@
'description' : 'the method used to solve problems if any.',
'type' : 'string',
'mode' : 'w' },
+ { 'id' : 'notification_method_id',
+ 'description' : 'the method used to notify results.',
+ 'type' : 'string',
+ 'mode' : 'w' },
{ 'id' : 'alarm_notification_mode',
'description' : 'defines the notification mode of an Alarm.'
'Never, on sense or always.',
More information about the Erp5-report
mailing list