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
...@@ -52,7 +52,7 @@ from zLOG import LOG, INFO ...@@ -52,7 +52,7 @@ from zLOG import LOG, INFO
try: try:
from Products.TimerService import getTimerService from Products.TimerService import getTimerService
except ImportError: except ImportError:
def getTimerService(): def getTimerService(self):
pass pass
# Using a RAM property (not a property of an instance) allows # Using a RAM property (not a property of an instance) allows
...@@ -275,7 +275,8 @@ class ActivityTool (Folder, UniqueObject): ...@@ -275,7 +275,8 @@ class ActivityTool (Folder, UniqueObject):
""" subscribe to the global Timer Service """ """ subscribe to the global Timer Service """
service = getTimerService(self) service = getTimerService(self)
if not service: if not service:
raise ValueError, "Can't find event service!" LOG('ActivityTool', INFO, 'TimerService not available')
return
service.subscribe(self) service.subscribe(self)
return "Subscribed to Timer Service" return "Subscribed to Timer Service"
...@@ -285,18 +286,19 @@ class ActivityTool (Folder, UniqueObject): ...@@ -285,18 +286,19 @@ class ActivityTool (Folder, UniqueObject):
""" unsubscribe from the global Timer Service """ """ unsubscribe from the global Timer Service """
service = getTimerService(self) service = getTimerService(self)
if not service: if not service:
raise ValueError, "Can't find event service!" LOG('ActivityTool', INFO, 'TimerService not available')
return
service.unsubscribe(self) service.unsubscribe(self)
return "Usubscribed from Timer Service" return "Unsubscribed from Timer Service"
def manage_beforeDelete(self, item, container): def manage_beforeDelete(self, item, container):
self.unsubscribe() self.unsubscribe()
Folder.manage_beforeDelete(self, item, container) Folder.inheritedAttribute('manage_beforeDelete')(self, item, container)
def manage_afterAdd(self, item, container): def manage_afterAdd(self, item, container):
self.subscribe() self.subscribe()
Folder.manage_afterAdd(self, item, container) Folder.inheritedAttribute('manage_afterAdd')(self, item, container)
def getCurrentNode(self): def getCurrentNode(self):
""" Return current node in form ip:port """ """ Return current node in form ip:port """
......
...@@ -37,7 +37,7 @@ from Products.ERP5 import _dtmldir ...@@ -37,7 +37,7 @@ from Products.ERP5 import _dtmldir
from Products.CMFCore import CMFCorePermissions from Products.CMFCore import CMFCorePermissions
from DateTime import DateTime from DateTime import DateTime
#from zLOG import LOG from zLOG import LOG, INFO
try: try:
from Products.TimerService import getTimerService from Products.TimerService import getTimerService
...@@ -164,7 +164,8 @@ TemplateTool manages Business Templates.""" ...@@ -164,7 +164,8 @@ TemplateTool manages Business Templates."""
""" subscribe to the global Timer Service """ """ subscribe to the global Timer Service """
service = getTimerService(self) service = getTimerService(self)
if not service: if not service:
raise ValueError, "Can't find event service!" LOG('AlarmTool', INFO, 'TimerService not available')
return
service.subscribe(self) service.subscribe(self)
return "Subscribed to Timer Service" return "Subscribed to Timer Service"
...@@ -174,18 +175,19 @@ TemplateTool manages Business Templates.""" ...@@ -174,18 +175,19 @@ TemplateTool manages Business Templates."""
""" unsubscribe from the global Timer Service """ """ unsubscribe from the global Timer Service """
service = getTimerService(self) service = getTimerService(self)
if not service: if not service:
raise ValueError, "Can't find event service!" LOG('AlarmTool', INFO, 'TimerService not available')
return
service.unsubscribe(self) service.unsubscribe(self)
return "Usubscribed from Timer Service" return "Usubscribed from Timer Service"
def manage_beforeDelete(self, item, container): def manage_beforeDelete(self, item, container):
self.unsubscribe() self.unsubscribe()
Folder.manage_beforeDelete(self, item, container) BaseTool.inheritedAttribute('manage_beforeDelete')(self, item, container)
def manage_afterAdd(self, item, container): def manage_afterAdd(self, item, container):
self.subscribe() self.subscribe()
Folder.manage_afterAdd(self, item, container) BaseTool.inheritedAttribute('manage_afterAdd')(self, item, container)
def process_timer(self, tick, interval): def process_timer(self, tick, 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