From f2fe551d4c2d656d032bdacf9f1ba9c2285919d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Mon, 2 Aug 2010 15:50:05 +0000
Subject: [PATCH] make RulesTool inherit from BaseTool

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37412 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Tool/RuleTool.py          | 46 ++++----------------------
 product/ERP5/dtml/explainRuleTool.dtml |  2 +-
 2 files changed, 7 insertions(+), 41 deletions(-)

diff --git a/product/ERP5/Tool/RuleTool.py b/product/ERP5/Tool/RuleTool.py
index 51857d8e48..33c075b5a7 100644
--- a/product/ERP5/Tool/RuleTool.py
+++ b/product/ERP5/Tool/RuleTool.py
@@ -26,19 +26,15 @@
 #
 ##############################################################################
 
-from Products.CMFCore.utils import UniqueObject
-
+from Products.ERP5Type.Tool.BaseTool import BaseTool
 from AccessControl import ClassSecurityInfo
 from Products.ERP5Type.Globals import InitializeClass, DTMLFile
-from Products.ERP5Type.Core.Folder import Folder
 from Products.ERP5Type import Permissions
 from Products.CMFCore.utils import getToolByName
 
 from Products.ERP5 import _dtmldir
 
-from zLOG import LOG
-
-class RuleTool (UniqueObject, Folder):
+class RuleTool(BaseTool):
     """
     The RulesTool implements portal object
     transformation policies.
@@ -76,52 +72,22 @@ class RuleTool (UniqueObject, Folder):
     according to templates. Allows to parametrize modules
     such as payroll.
 
-    Try to mimic: XSL semantics
-
-    Status : OK
-
-    NEW NAME : Rules Tool
-
-    TODO: XXX Please use BaseTool
     """
     id = 'portal_rules'
     meta_type = 'ERP5 Rule Tool'
     portal_type = 'Rule Tool'
-    allowed_types = ( 'ERP5 Order Rule', 'ERP5 Transformation Rule', 'ERP5 Zero Stock Rule', 'ERP5 Delivery Rule', 'ERP5 Amortisation Rule')
+    allowed_types = ( 'ERP5 Order Rule', 'ERP5 Transformation Rule',
+                      'ERP5 Zero Stock Rule', 'ERP5 Delivery Rule',
+                      'ERP5 Amortisation Rule')
 
     # Declarative Security
     security = ClassSecurityInfo()
 
-    #
-    #   ZMI methods
-    #
-    manage_options = ( ( { 'label'      : 'Overview'
-                         , 'action'     : 'manage_overview'
-                         }
-                        ,
-                        )
-                     + Folder.manage_options
-                     )
-
     security.declareProtected( Permissions.ManagePortal, 'manage_overview' )
     manage_overview = DTMLFile( 'explainRuleTool', _dtmldir )
 
-    # Filter content (ZMI))
-    def __init__(self):
-        return Folder.__init__(self, RuleTool.id)
-
-    # Filter content (ZMI))
-    def filtered_meta_types(self, user=None):
-        # Filters the list of available meta types.
-        all = RuleTool.inheritedAttribute('filtered_meta_types')(self)
-        meta_types = []
-        for meta_type in self.all_meta_types():
-            if meta_type['name'] in self.allowed_types:
-                meta_types.append(meta_type)
-        return meta_types
-
     security.declareProtected(Permissions.AccessContentsInformation,
-        'searchRuleList')
+                              'searchRuleList')
     def searchRuleList(self, movement, tested_base_category_list=None, **kw):
       """
       this method searches for rules, as predicates against movement
diff --git a/product/ERP5/dtml/explainRuleTool.dtml b/product/ERP5/dtml/explainRuleTool.dtml
index fbaf851e74..225487631f 100644
--- a/product/ERP5/dtml/explainRuleTool.dtml
+++ b/product/ERP5/dtml/explainRuleTool.dtml
@@ -1,6 +1,6 @@
 <dtml-var manage_page_header>
 <dtml-var manage_tabs>
 
-<p>Explain SumulationTool</p>
+<p>Rule Tool contains Rules</p>
 
 <dtml-var manage_page_footer>
-- 
2.30.9