Commit c3de53b8 authored by Vincent Pelletier's avatar Vincent Pelletier

ActivityTool: Inherit from BaseTool.

Reduces code duplication.
parent c2ebc937
...@@ -34,7 +34,7 @@ from types import StringType ...@@ -34,7 +34,7 @@ from types import StringType
from collections import defaultdict from collections import defaultdict
from cPickle import dumps, loads from cPickle import dumps, loads
from Products.CMFCore import permissions as CMFCorePermissions from Products.CMFCore import permissions as CMFCorePermissions
from Products.ERP5Type.Core.Folder import Folder from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.CMFActivity.ActiveResult import ActiveResult from Products.CMFActivity.ActiveResult import ActiveResult
from Products.CMFActivity.ActiveObject import DEFAULT_ACTIVITY from Products.CMFActivity.ActiveObject import DEFAULT_ACTIVITY
from Products.CMFActivity.ActivityConnection import ActivityConnection from Products.CMFActivity.ActivityConnection import ActivityConnection
...@@ -607,7 +607,7 @@ def cancelProcessShutdown(): ...@@ -607,7 +607,7 @@ def cancelProcessShutdown():
is_running_lock.release() is_running_lock.release()
has_processed_shutdown = False has_processed_shutdown = False
class ActivityTool (Folder, UniqueObject): class ActivityTool (BaseTool):
""" """
ActivityTool is the central point for activity management. ActivityTool is the central point for activity management.
...@@ -634,7 +634,7 @@ class ActivityTool (Folder, UniqueObject): ...@@ -634,7 +634,7 @@ class ActivityTool (Folder, UniqueObject):
, { 'label' : 'LoadBalancing', 'action' : 'manageLoadBalancing'} , { 'label' : 'LoadBalancing', 'action' : 'manageLoadBalancing'}
, { 'label' : 'Advanced', 'action' : 'manageActivitiesAdvanced' } , { 'label' : 'Advanced', 'action' : 'manageActivitiesAdvanced' }
, ,
] + list(Folder.manage_options)) ] + list(BaseTool.manage_options))
security.declareProtected( CMFCorePermissions.ManagePortal , 'manageActivities' ) security.declareProtected( CMFCorePermissions.ManagePortal , 'manageActivities' )
manageActivities = DTMLFile( 'dtml/manageActivities', globals() ) manageActivities = DTMLFile( 'dtml/manageActivities', globals() )
...@@ -660,15 +660,10 @@ class ActivityTool (Folder, UniqueObject): ...@@ -660,15 +660,10 @@ class ActivityTool (Folder, UniqueObject):
LOG('ActivityTool', 0, real_SQLDict_setPriority(src__=1, **kw)) LOG('ActivityTool', 0, real_SQLDict_setPriority(src__=1, **kw))
return real_SQLDict_setPriority(**kw) return real_SQLDict_setPriority(**kw)
def __init__(self, id=None):
if id is None:
id = ActivityTool.id
Folder.__init__(self, id)
# Filter content (ZMI)) # Filter content (ZMI))
def filtered_meta_types(self, user=None): def filtered_meta_types(self, user=None):
# Filters the list of available meta types. # Filters the list of available meta types.
all = Folder.filtered_meta_types(self) all = BaseTool.filtered_meta_types(self)
meta_types = [] meta_types = []
for meta_type in self.all_meta_types(): for meta_type in self.all_meta_types():
if meta_type['name'] in self.allowed_types: if meta_type['name'] in self.allowed_types:
...@@ -844,12 +839,12 @@ class ActivityTool (Folder, UniqueObject): ...@@ -844,12 +839,12 @@ class ActivityTool (Folder, UniqueObject):
security.declarePrivate('manage_beforeDelete') security.declarePrivate('manage_beforeDelete')
def manage_beforeDelete(self, item, container): def manage_beforeDelete(self, item, container):
self.unsubscribe() self.unsubscribe()
Folder.inheritedAttribute('manage_beforeDelete')(self, item, container) BaseTool.inheritedAttribute('manage_beforeDelete')(self, item, container)
security.declarePrivate('manage_afterAdd') security.declarePrivate('manage_afterAdd')
def manage_afterAdd(self, item, container): def manage_afterAdd(self, item, container):
self.subscribe() self.subscribe()
Folder.inheritedAttribute('manage_afterAdd')(self, item, container) BaseTool.inheritedAttribute('manage_afterAdd')(self, item, container)
security.declareProtected(CMFCorePermissions.ManagePortal, 'getServerAddress') security.declareProtected(CMFCorePermissions.ManagePortal, 'getServerAddress')
def getServerAddress(self): def getServerAddress(self):
......
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