Commit b7f6452a authored by Jérome Perrin's avatar Jérome Perrin

use inheritedAttribute to call parent's method


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4183 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7ef8098f
......@@ -50,10 +50,10 @@ from OFS.Traversable import NotFound
from zLOG import LOG, INFO
try:
from Products.TimerService import getTimerService
from Products.TimerService import getTimerService
except ImportError:
def getTimerService():
pass
def getTimerService(self):
pass
# Using a RAM property (not a property of an instance) allows
# to prevent from storing a state in the ZODB (and allows to restart...)
......@@ -275,7 +275,8 @@ class ActivityTool (Folder, UniqueObject):
""" subscribe to the global Timer Service """
service = getTimerService(self)
if not service:
raise ValueError, "Can't find event service!"
LOG('ActivityTool', INFO, 'TimerService not available')
return
service.subscribe(self)
return "Subscribed to Timer Service"
......@@ -285,19 +286,20 @@ class ActivityTool (Folder, UniqueObject):
""" unsubscribe from the global Timer Service """
service = getTimerService(self)
if not service:
raise ValueError, "Can't find event service!"
LOG('ActivityTool', INFO, 'TimerService not available')
return
service.unsubscribe(self)
return "Usubscribed from Timer Service"
return "Unsubscribed from Timer Service"
def manage_beforeDelete(self, item, container):
self.unsubscribe()
Folder.manage_beforeDelete(self, item, container)
Folder.inheritedAttribute('manage_beforeDelete')(self, item, container)
def manage_afterAdd(self, item, container):
self.subscribe()
Folder.manage_afterAdd(self, item, container)
Folder.inheritedAttribute('manage_afterAdd')(self, item, container)
def getCurrentNode(self):
""" Return current node in form ip:port """
port = ''
......
......@@ -37,7 +37,7 @@ from Products.ERP5 import _dtmldir
from Products.CMFCore import CMFCorePermissions
from DateTime import DateTime
#from zLOG import LOG
from zLOG import LOG, INFO
try:
from Products.TimerService import getTimerService
......@@ -164,8 +164,9 @@ TemplateTool manages Business Templates."""
""" subscribe to the global Timer Service """
service = getTimerService(self)
if not service:
raise ValueError, "Can't find event service!"
LOG('AlarmTool', INFO, 'TimerService not available')
return
service.subscribe(self)
return "Subscribed to Timer Service"
......@@ -174,19 +175,20 @@ TemplateTool manages Business Templates."""
""" unsubscribe from the global Timer Service """
service = getTimerService(self)
if not service:
raise ValueError, "Can't find event service!"
LOG('AlarmTool', INFO, 'TimerService not available')
return
service.unsubscribe(self)
return "Usubscribed from Timer Service"
def manage_beforeDelete(self, item, container):
self.unsubscribe()
Folder.manage_beforeDelete(self, item, container)
BaseTool.inheritedAttribute('manage_beforeDelete')(self, item, container)
def manage_afterAdd(self, item, container):
self.subscribe()
Folder.manage_afterAdd(self, item, container)
BaseTool.inheritedAttribute('manage_afterAdd')(self, item, container)
def process_timer(self, tick, interval):
"""
Call tic() every x seconds. x is defined in self.interval
......
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