From c7cb566542591af6175e5653846c29d1db45ed48 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Thu, 16 May 2013 14:05:47 +0200
Subject: [PATCH] Make set setter reuse more list setter

---
 product/ERP5Type/Accessor/Category.py | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/product/ERP5Type/Accessor/Category.py b/product/ERP5Type/Accessor/Category.py
index 089acc4504..2bc0d5f711 100644
--- a/product/ERP5Type/Accessor/Category.py
+++ b/product/ERP5Type/Accessor/Category.py
@@ -88,23 +88,10 @@ class DefaultSetter(BaseSetter):
                                                  checked_permission=kw.get('checked_permission', None))
       return (instance, )
 
-class SetSetter(BaseSetter):
+class SetSetter(ListSetter):
     """
       Sets a set of category
     """
-    _need__name__=1
-
-    # Generic Definition of Method Object
-    # This is required to call the method form the Web
-    func_code = func_code()
-    func_code.co_varnames = ('self', 'category')
-    func_code.co_argcount = 2
-    func_defaults = ()
-
-    def __init__(self, id, key):
-      self._id = id
-      self.__name__ = id
-      self._key = key
 
     def __call__(self, instance, value, *args, **kw):
       """
@@ -113,14 +100,7 @@ class SetSetter(BaseSetter):
       """
       if type(value) not in (set, frozenset):
         value = frozenset(value)
-      instance._setCategoryMembership(self._key, tuple(value),
-                                      spec=kw.get('spec',()),
-                                      filter=kw.get('filter', None),
-                                      portal_type=kw.get('portal_type',()),
-                                      base=kw.get('base', 0),
-                                      keep_default=1,
-                                      checked_permission=kw.get('checked_permission', None))
-      return (instance, )
+      return ListSetter.__call__(self, instance, value, *args, **kw)
 
 
 class DefaultGetter(BaseGetter):
-- 
2.30.9