Commit c98ccfc5 authored by Aurel's avatar Aurel

if no report method defined, don't fail


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7804 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1bd22867
...@@ -88,7 +88,7 @@ class Alarm(Periodicity, XMLObject): ...@@ -88,7 +88,7 @@ class Alarm(Periodicity, XMLObject):
activity. We don't care about the response, we just want to start activity. We don't care about the response, we just want to start
some calculations. Results should be read with the method 'sense' some calculations. Results should be read with the method 'sense'
later. later.
""" """
# Set the new date # Set the new date
LOG('activeSense, self.getPath()',0,self.getPath()) LOG('activeSense, self.getPath()',0,self.getPath())
...@@ -106,8 +106,8 @@ class Alarm(Periodicity, XMLObject): ...@@ -106,8 +106,8 @@ class Alarm(Periodicity, XMLObject):
def sense(self): def sense(self):
""" """
This method returns True or False. False for no problem, True for problem. This method returns True or False. False for no problem, True for problem.
This method should respond quickly. Basically the response depends on some This method should respond quickly. Basically the response depends on some
previous calculation made by activeSense. previous calculation made by activeSense.
""" """
method_id = self.getSenseMethodId() method_id = self.getSenseMethodId()
...@@ -131,13 +131,15 @@ class Alarm(Periodicity, XMLObject): ...@@ -131,13 +131,15 @@ class Alarm(Periodicity, XMLObject):
security.declareProtected(Permissions.View, 'report') security.declareProtected(Permissions.View, 'report')
def report(self,process=None): def report(self,process=None):
""" """
This methods produces a report (HTML) This methods produces a report (HTML)
This generate the output of the results. It can be used to nicely This generate the output of the results. It can be used to nicely
explain the problem. We don't do calculation at this time, it should explain the problem. We don't do calculation at this time, it should
be made by activeSense. be made by activeSense.
""" """
method_id = self.getReportMethodId() method_id = self.getReportMethodId(None)
LOG('Alarm.report, method_id',0,method_id) #LOG('Alarm.report, method_id',0,method_id)
if method_id is None:
return ''
method = getattr(self,method_id) method = getattr(self,method_id)
process = self.getCurrentActiveProcess() process = self.getCurrentActiveProcess()
if process is None: if process is None:
...@@ -150,7 +152,7 @@ class Alarm(Periodicity, XMLObject): ...@@ -150,7 +152,7 @@ class Alarm(Periodicity, XMLObject):
def solve(self): def solve(self):
""" """
This method tries solves the problem detected by sense. This method tries solves the problem detected by sense.
This solve the problem if there is a problem detected by sense. If This solve the problem if there is a problem detected by sense. If
no problems, then nothing to do here. no problems, then nothing to do here.
""" """
...@@ -159,9 +161,9 @@ class Alarm(Periodicity, XMLObject): ...@@ -159,9 +161,9 @@ class Alarm(Periodicity, XMLObject):
security.declareProtected(Permissions.ModifyPortalContent, 'notify') security.declareProtected(Permissions.ModifyPortalContent, 'notify')
def _notify(self): def _notify(self):
""" """
This method is called to notify people that some alarm has This method is called to notify people that some alarm has
been sensed. been sensed.
for example we can send email. for example we can send email.
We define nothing here, because we will use an interaction workflow. We define nothing here, because we will use an interaction workflow.
......
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