From eca805c414c5145fc4d65d69d88c691a38b250d4 Mon Sep 17 00:00:00 2001 From: Jean-Paul Smets <jp@nexedi.com> Date: Wed, 15 Aug 2007 17:31:11 +0000 Subject: [PATCH] A new accessor family is provided : Alias. The purpose of Alias accessors is to reduce the number of independent accessors and try to factorise accessors. With Aliases, overloading the default behaviour of aliases may become easier. For example, the method setFirstName will now invoke _setFirstName and then reindex. This way, an interaction method will only need to use _setFirstName as trigger. If the user wants to overload _setFirstName , it becomes possible without having to overload setFirstName at the same time. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15678 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/Accessor/Accessor.py | 19 ++-- product/ERP5Type/Accessor/AcquiredProperty.py | 5 + product/ERP5Type/Accessor/Alias.py | 81 +++++++++++++++ product/ERP5Type/Accessor/Base.py | 9 +- product/ERP5Type/Accessor/Category.py | 20 +++- product/ERP5Type/Accessor/ContentProperty.py | 8 ++ product/ERP5Type/Accessor/List.py | 11 +++ product/ERP5Type/Accessor/Value.py | 38 +++++-- product/ERP5Type/Utils.py | 98 ++++++------------- 9 files changed, 201 insertions(+), 88 deletions(-) create mode 100644 product/ERP5Type/Accessor/Alias.py diff --git a/product/ERP5Type/Accessor/Accessor.py b/product/ERP5Type/Accessor/Accessor.py index 11f04b2918..0bb4d02c4b 100644 --- a/product/ERP5Type/Accessor/Accessor.py +++ b/product/ERP5Type/Accessor/Accessor.py @@ -50,15 +50,16 @@ class Accessor(Method): def dummy_copy(self, id): # Copy an accessor and change its id/name - #self.__call__ = None - #try: - # clone_instance = self.__class__(*self.__getinitargs__()) - #except: - # LOG('dummy_copy', 0, '%r could not be generated with %r' % (id, self.__class__), error=sys.exc_info()) - # raise clone_instance = copy(self) - #delattr(self, '__call__') - #if hasattr(clone_instance, '__call__'): - # delattr(clone_instance, '__call__') clone_instance.__name__ = id return clone_instance + + def asAlias(self, id): + # Returns an alias + from Alias import Alias + return Alias(id, self.__name__) + + def asReindexAlias(self, id): + # Returns a reindexing alias + from Alias import ReindexAlias + return ReindexAlias(id, self.__name__) \ No newline at end of file diff --git a/product/ERP5Type/Accessor/AcquiredProperty.py b/product/ERP5Type/Accessor/AcquiredProperty.py index b7dce91cc9..826a79dcde 100644 --- a/product/ERP5Type/Accessor/AcquiredProperty.py +++ b/product/ERP5Type/Accessor/AcquiredProperty.py @@ -26,6 +26,8 @@ # ############################################################################## +import warnings + from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method from Products.ERP5Type.PsycoWrapper import psyco from zLOG import LOG @@ -160,6 +162,9 @@ class Setter(Method): portal_type=self._portal_type[0]) instance._v_accessor_created_object = 1 if self._reindex: + warnings.warn("The reindexing accessors are deprecated.\n" + "Please use Alias.Reindex instead.", + DeprecationWarning) o.setProperty(self._acquired_property, value, *args, **kw) else: o._setProperty(self._acquired_property, value, *args, **kw) diff --git a/product/ERP5Type/Accessor/Alias.py b/product/ERP5Type/Accessor/Alias.py new file mode 100644 index 0000000000..c8d5bb0093 --- /dev/null +++ b/product/ERP5Type/Accessor/Alias.py @@ -0,0 +1,81 @@ +############################################################################## +# +# Copyright (c) 2007 Nexedi SA and Contributors. All Rights Reserved. +# Jean-Paul Smets-Solanes <jp@nexedi.com> +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +from Accessor import Accessor as Method + +# Creation of default constructor +class func_code: pass + +class Reindex(Method): + """ + Calls a given accessor and reindexes the object. + + TODO: reindex property may be removed on all accessors + """ + _need__name__=1 + + # Generic Definition of Method Object + # This is required to call the method form the Web + # More information at http://www.zope.org/Members/htrd/howto/FunctionTemplate + func_code = func_code() + func_code.co_varnames = ('self',) + func_code.co_argcount = 1 + func_defaults = () + + def __init__(self, id, accessor_id): + self._id = id + self.__name__ = id + self._accessor_id = accessor_id + + def __call__(self, instance, *args, **kw): + method = getattr(instance, self._accessor_id) + method(*args, **kw) + instance.reindexObject() + +class Dummy(Reindex): + """ + Calls a given accessor. + """ + _need__name__=1 + + # Generic Definition of Method Object + # This is required to call the method form the Web + # More information at http://www.zope.org/Members/htrd/howto/FunctionTemplate + func_code = func_code() + func_code.co_varnames = ('self',) + func_code.co_argcount = 1 + func_defaults = () + + def __init__(self, id, accessor_id): + self._id = id + self.__name__ = id + self._accessor_id = accessor_id + + def __call__(self, instance, *args, **kw): + method = getattr(instance, self._accessor_id) + method(*args, **kw) \ No newline at end of file diff --git a/product/ERP5Type/Accessor/Base.py b/product/ERP5Type/Accessor/Base.py index 8dd5b21572..8dbe61bd04 100644 --- a/product/ERP5Type/Accessor/Base.py +++ b/product/ERP5Type/Accessor/Base.py @@ -26,6 +26,8 @@ # ############################################################################## +import warnings + from ZPublisher.HTTPRequest import FileUpload from TypeDefinition import type_definition, list_types, ATTRIBUTE_PREFIX from Accessor import Accessor as Method @@ -91,6 +93,9 @@ class Setter(Method): setattr(instance, self._storage_id, self._cast(args[0])) else: # Call the private setter + warnings.warn("The reindexing accessors are deprecated.\n" + "Please use Alias.Reindex instead.", + DeprecationWarning) method = getattr(instance, '_' + self._id) method(*args, **kw) if self._reindex: instance.reindexObject() # XXX Should the Setter check @@ -108,13 +113,13 @@ evaluateTales = CachingMethod(_evaluateTales, id = 'evaluateTales', cache_factor class Getter(Method): """ - Gets an attribute value. A default value can be provided if needed. + Gets an attribute value. A default value can be provided if needed. Note that 'default' argument is the first positional argument, this is important if you want to override a Getter in a class, overloaded accessors have to respect this:: - getSomething(self, [default], [name=value, [name=value], ]) + getSomething(self, [default], [name=value, [name=value], ]) """ _need__name__=1 diff --git a/product/ERP5Type/Accessor/Category.py b/product/ERP5Type/Accessor/Category.py index 6573e1358f..a5e06bb9e0 100644 --- a/product/ERP5Type/Accessor/Category.py +++ b/product/ERP5Type/Accessor/Category.py @@ -26,6 +26,8 @@ # ############################################################################## +import warnings + from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method from zLOG import LOG from Products.ERP5Type.PsycoWrapper import psyco @@ -56,7 +58,11 @@ class ListSetter(Method): portal_type=kw.get('portal_type',()), base=kw.get('base', 0), keep_default=0) - if self._reindex: instance.reindexObject() + if self._reindex: + warnings.warn("The reindexing accessors are deprecated.\n" + "Please use Alias.Reindex instead.", + DeprecationWarning) + instance.reindexObject() Setter = ListSetter @@ -85,7 +91,11 @@ class DefaultSetter(Method): filter=kw.get('filter', None), portal_type=kw.get('portal_type',()), base=kw.get('base', 0)) - if self._reindex: instance.reindexObject() + if self._reindex: + warnings.warn("The reindexing accessors are deprecated.\n" + "Please use Alias.Reindex instead.", + DeprecationWarning) + instance.reindexObject() class SetSetter(Method): """ @@ -124,7 +134,11 @@ class SetSetter(Method): portal_type=kw.get('portal_type',()), base=kw.get('base', 0), keep_default=1) - if self._reindex: instance.reindexObject() + if self._reindex: + warnings.warn("The reindexing accessors are deprecated.\n" + "Please use Alias.Reindex instead.", + DeprecationWarning) + instance.reindexObject() class DefaultGetter(Method): diff --git a/product/ERP5Type/Accessor/ContentProperty.py b/product/ERP5Type/Accessor/ContentProperty.py index e3b5105075..428d4e7f38 100644 --- a/product/ERP5Type/Accessor/ContentProperty.py +++ b/product/ERP5Type/Accessor/ContentProperty.py @@ -26,6 +26,8 @@ # ############################################################################## +import warnings + from Base import func_code, type_definition, ATTRIBUTE_PREFIX, Method import Base from Products.ERP5Type.PsycoWrapper import psyco @@ -212,6 +214,9 @@ class Setter(Method): if o is None: available_id = k if o is not None and o.portal_type in self._portal_type: if self._reindex: + warnings.warn("The reindexing accessors are deprecated.\n" + "Please use Alias.Reindex instead.", + DeprecationWarning) o.setProperty(self._acquired_property, *args, **kw) else: o._setProperty(self._acquired_property, *args, **kw) @@ -222,6 +227,9 @@ class Setter(Method): portal_type=self._portal_type[0]) instance._v_accessor_created_object = 1 if self._reindex: + warnings.warn("The reindexing accessors are deprecated.\n" + "Please use Alias.Reindex instead.", + DeprecationWarning) o.setProperty(self._acquired_property, *args, **kw) else: o._setProperty(self._acquired_property, *args, **kw) diff --git a/product/ERP5Type/Accessor/List.py b/product/ERP5Type/Accessor/List.py index 4f03d2187f..861aa8a2e0 100644 --- a/product/ERP5Type/Accessor/List.py +++ b/product/ERP5Type/Accessor/List.py @@ -26,6 +26,8 @@ # ############################################################################## +import warnings + from Base import func_code, type_definition, list_types,\ ATTRIBUTE_PREFIX, Method, evaluateTales from TypeDefinition import asList, identity @@ -90,6 +92,9 @@ class DefaultSetter(Method): setattr(instance, self._storage_id, tuple(value)) else: # Call the private setter + warnings.warn("The reindexing accessors are deprecated.\n" + "Please use Alias.Reindex instead.", + DeprecationWarning) method = getattr(instance, '_' + self._id) method(*args, **kw) if self._reindex: instance.reindexObject() @@ -111,6 +116,9 @@ class ListSetter(DefaultSetter): setattr(instance, self._storage_id, tuple(value)) else: # Call the private setter + warnings.warn("The reindexing accessors are deprecated.\n" + "Please use Alias.Reindex instead.", + DeprecationWarning) method = getattr(instance, '_' + self._id) method(*args, **kw) @@ -182,6 +190,9 @@ class SetSetter(Method): setattr(instance, self._storage_id, tuple(new_list_value)) else: # Call the private setter + warnings.warn("The reindexing accessors are deprecated.\n" + "Please use Alias.Reindex instead.", + DeprecationWarning) method = getattr(instance, '_' + self._id) method(*args, **kw) if self._reindex: instance.reindexObject() diff --git a/product/ERP5Type/Accessor/Value.py b/product/ERP5Type/Accessor/Value.py index f504803dfa..ce46ff272e 100644 --- a/product/ERP5Type/Accessor/Value.py +++ b/product/ERP5Type/Accessor/Value.py @@ -26,6 +26,8 @@ # ############################################################################## +import warnings + from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method from zLOG import LOG from Products.ERP5Type.PsycoWrapper import psyco @@ -53,7 +55,11 @@ class SetSetter(Method): filter=kw.get('filter', None), portal_type=kw.get('portal_type',()), keep_default=1) - if self._reindex: instance.reindexObject() + if self._reindex: + warnings.warn("The reindexing accessors are deprecated.\n" + "Please use Alias.Reindex instead.", + DeprecationWarning) + instance.reindexObject() psyco.bind(__call__) @@ -71,7 +77,11 @@ class ListSetter(SetSetter): filter=kw.get('filter', None), portal_type=kw.get('portal_type',()), keep_default=0) - if self._reindex: instance.reindexObject() + if self._reindex: + warnings.warn("The reindexing accessors are deprecated.\n" + "Please use Alias.Reindex instead.", + DeprecationWarning) + instance.reindexObject() psyco.bind(__call__) @@ -90,7 +100,11 @@ class DefaultSetter(SetSetter): spec=kw.get('spec',()), filter=kw.get('filter', None), portal_type=kw.get('portal_type',())) - if self._reindex: instance.reindexObject() + if self._reindex: + warnings.warn("The reindexing accessors are deprecated.\n" + "Please use Alias.Reindex instead.", + DeprecationWarning) + instance.reindexObject() psyco.bind(__call__) @@ -447,7 +461,11 @@ class UidSetSetter(Method): filter=kw.get('filter', None), portal_type=kw.get('portal_type',()), keep_default=1) - if self._reindex: instance.reindexObject() + if self._reindex: + warnings.warn("The reindexing accessors are deprecated.\n" + "Please use Alias.Reindex instead.", + DeprecationWarning) + instance.reindexObject() class UidListSetter(UidSetSetter): """ @@ -463,7 +481,11 @@ class UidListSetter(UidSetSetter): filter=kw.get('filter', None), portal_type=kw.get('portal_type',()), keep_default=0) - if self._reindex: instance.reindexObject() + if self._reindex: + warnings.warn("The reindexing accessors are deprecated.\n" + "Please use Alias.Reindex instead.", + DeprecationWarning) + instance.reindexObject() UidSetter = UidListSetter @@ -480,7 +502,11 @@ class UidDefaultSetter(UidSetSetter): spec=kw.get('spec',()), filter=kw.get('filter', None), portal_type=kw.get('portal_type',())) - if self._reindex: instance.reindexObject() + if self._reindex: + warnings.warn("The reindexing accessors are deprecated.\n" + "Please use Alias.Reindex instead.", + DeprecationWarning) + instance.reindexObject() class DefaultIdGetter(Method): """ diff --git a/product/ERP5Type/Utils.py b/product/ERP5Type/Utils.py index f570875038..0240c90dee 100644 --- a/product/ERP5Type/Utils.py +++ b/product/ERP5Type/Utils.py @@ -1397,7 +1397,8 @@ except (ImportError, AttributeError): from Base import Base as BaseClass from Accessor import Base, List, Acquired, Content,\ - AcquiredProperty, ContentProperty + AcquiredProperty, ContentProperty, \ + Alias import types # Compile accessors @@ -1589,7 +1590,7 @@ def createDefaultAccessors(property_holder, id, prop = None, reindex = 1 ) if not hasattr(property_holder, accessor_name) or prop.get('override',0): - setattr(property_holder, accessor_name, base_accessor) + setattr(property_holder, accessor_name, Alias.Reindex(accessor_name, '_' + accessor_name)) property_holder.security.declareProtected( write_permission, accessor_name ) accessor_name = '_set' + UpperCase(composed_id) if not hasattr(property_holder, accessor_name) or prop.get('override',0): @@ -1617,7 +1618,7 @@ def createDefaultAccessors(property_holder, id, prop = None, reindex = 1 ) if not hasattr(property_holder, accessor_name) or prop.get('override',0): - setattr(property_holder, accessor_name, base_accessor) + setattr(property_holder, accessor_name, Alias.Reindex(accessor_name, '_' + accessor_name)) property_holder.security.declareProtected( write_permission, accessor_name ) accessor_name = '_setDefault' + UpperCase(composed_id) if not hasattr(property_holder, accessor_name) or prop.get('override',0): @@ -1780,16 +1781,12 @@ def createDefaultAccessors(property_holder, id, prop = None, setattr(property_holder, accessor_name, base_accessor) property_holder.security.declareProtected( write_permission, accessor_name ) accessor_name = 'set' + UpperCase(composed_id) - base_accessor = ContentProperty.Setter(accessor_name, composed_id, prop['type'], aq_id, - portal_type = prop.get('portal_type'), storage_id = prop.get('storage_id'), reindex=1) if not hasattr(property_holder, accessor_name) or prop.get('override',0): - setattr(property_holder, accessor_name, base_accessor) + setattr(property_holder, accessor_name, Alias.Reindex(accessor_name, '_' + accessor_name)) property_holder.security.declareProtected( write_permission, accessor_name ) accessor_name = 'set' + UpperCase(composed_id) + 'List' - base_accessor = ContentProperty.Setter(accessor_name, composed_id + '_list', prop['type'], aq_id + '_list', - portal_type = prop.get('portal_type'), storage_id = prop.get('storage_id'), reindex=1) if not hasattr(property_holder, accessor_name) or prop.get('override',0): - setattr(property_holder, accessor_name, base_accessor) + setattr(property_holder, accessor_name, Alias.Reindex(accessor_name, '_' + accessor_name)) property_holder.security.declareProtected( write_permission, accessor_name ) # No default getter YET XXXXXXXXXXXXXX # No list getter YET XXXXXXXXXXXXXX @@ -1809,40 +1806,22 @@ def createDefaultAccessors(property_holder, id, prop = None, ###################################################### # Create Setters if prop['type'] in list_types or prop.get('multivalued', 0): - # Create setters for a list property (reindexing) - # The base accessor sets the list to a singleton - # and allows simulates a simple property - setter_name = 'set' + UpperCase(id) - base_setter = List.Setter(setter_name, id, prop['type'], reindex=1, - storage_id = prop.get('storage_id')) - # The default setter sets the first item of a list without changing other items - setter_name = 'setDefault' + UpperCase(id) - default_setter = List.DefaultSetter(setter_name, id, prop['type'], reindex=1, - storage_id = prop.get('storage_id')) - # The list setter sets the whole list - setter_name = 'set' + UpperCase(id) + 'List' - list_setter = List.ListSetter(setter_name, id, prop['type'], reindex=1, - storage_id = prop.get('storage_id')) - # The list setter sets the whole list - setter_name = 'set' + UpperCase(id) + 'Set' - set_setter = List.SetSetter(setter_name, id, prop['type'], reindex=1, - storage_id = prop.get('storage_id')) - # Create setters for a list property + # Create setters for a list property by aliasing setter_name = 'set' + UpperCase(id) if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, base_setter) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + setter_name)) property_holder.security.declareProtected(write_permission, setter_name) setter_name = 'setDefault' + UpperCase(id) if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, default_setter) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + setter_name)) property_holder.security.declareProtected(write_permission, setter_name) setter_name = 'set' + UpperCase(id) + 'List' if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, list_setter) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + setter_name)) property_holder.security.declareProtected(write_permission, setter_name) setter_name = 'set' + UpperCase(id) + 'Set' if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, set_setter) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + setter_name)) property_holder.security.declareProtected(write_permission, setter_name) # Create setters for a list property (no reindexing) # The base accessor sets the list to a singleton @@ -1892,29 +1871,25 @@ def createDefaultAccessors(property_holder, id, prop = None, # Create setters for a list property (reindexing) # The base accessor sets the list to a singleton # and allows simulates a simple property - setter_name = 'set' + UpperCase(id) - base_setter = Content.Setter(setter_name, id, prop['type'], reindex=1, - storage_id = prop.get('storage_id')) + base_setter_name = 'set' + UpperCase(id) # The default setter sets the first item of a list without changing other items - setter_name = 'setDefault' + UpperCase(id) - default_setter = Content.DefaultSetter(setter_name, id, prop['type'], reindex=1, - storage_id = prop.get('storage_id')) + default_setter_name = 'setDefault' + UpperCase(id) # Create setters for an object property setter_name = 'set' + UpperCase(id) if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, base_setter.dummy_copy(setter_name)) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + base_setter_name)) property_holder.security.declareProtected(write_permission, setter_name) setter_name = 'setDefault' + UpperCase(id) if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, default_setter.dummy_copy(setter_name)) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + default_setter_name)) property_holder.security.declareProtected(write_permission, setter_name) setter_name = 'set' + UpperCase(id) + 'Value' if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, base_setter.dummy_copy(setter_name)) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + base_setter_name)) property_holder.security.declareProtected(write_permission, setter_name) setter_name = 'setDefault' + UpperCase(id) + 'Value' if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, default_setter.dummy_copy(setter_name)) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + default_setter_name)) property_holder.security.declareProtected(write_permission, setter_name) # Create setters for a list property (no reindexing) # The base accessor sets the list to a singleton @@ -1954,10 +1929,8 @@ def createDefaultAccessors(property_holder, id, prop = None, else: # Create setters for a simple property setter_name = 'set' + UpperCase(id) - setter = Base.Setter(setter_name, id, prop['type'], reindex=1, - storage_id = prop.get('storage_id')) if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, setter) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + setter_name)) property_holder.security.declareProtected(write_permission, setter_name) setter_name = '_set' + UpperCase(id) setter = Base.Setter(setter_name, id, prop['type'], reindex=0, @@ -2070,21 +2043,18 @@ def createCategoryAccessors(property_holder, id, setattr(property_holder, accessor_name, accessor.dummy_copy(accessor_name)) setter_name = 'set' + UpperCase(id) - setter = Category.Setter(setter_name, id, reindex=1) if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, setter) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + setter_name)) property_holder.security.declareProtected(write_permission, setter_name) setter_name = 'set' + UpperCase(id) + 'List' - setter = Category.ListSetter(setter_name, id, reindex=1) if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, setter) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + setter_name)) property_holder.security.declareProtected(write_permission, setter_name) setter_name = 'setDefault' + UpperCase(id) - setter = Category.DefaultSetter(setter_name, id, reindex=1) if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, setter) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + setter_name)) property_holder.security.declareProtected(write_permission, setter_name) setter_name = '_set' + UpperCase(id) @@ -2112,7 +2082,7 @@ def createCategoryAccessors(property_holder, id, setattr(property_holder, setter_name, setter.dummy_copy(setter_name)) setter_name = 'set' + UpperCase(id) + 'Set' if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, setter.dummy_copy(setter_name)) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + setter_name)) property_holder.security.declareProtected(write_permission, setter_name) setter_name = '_setDefault' + UpperCase(id) @@ -2434,27 +2404,23 @@ def createValueAccessors(property_holder, id, setattr(property_holder, accessor_name, accessor.dummy_copy(accessor_name)) setter_name = 'set' + UpperCase(id) + 'Value' - setter = Value.Setter(setter_name, id, reindex=1) if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, setter) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + setter_name)) property_holder.security.declareProtected(write_permission, setter_name) setter_name = 'set' + UpperCase(id) + 'ValueList' - setter = Value.ListSetter(setter_name, id, reindex=1) if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, setter) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + setter_name)) property_holder.security.declareProtected(write_permission, setter_name) setter_name = 'set' + UpperCase(id) + 'ValueSet' - setter = Value.SetSetter(setter_name, id, reindex=1) if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, setter) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + setter_name)) property_holder.security.declareProtected(write_permission, setter_name) setter_name = 'setDefault' + UpperCase(id) + 'Value' - setter = Value.DefaultSetter(setter_name, id, reindex=1) if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, setter) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + setter_name)) property_holder.security.declareProtected(write_permission, setter_name) setter_name = '_set' + UpperCase(id) + 'Value' @@ -2499,27 +2465,23 @@ def createValueAccessors(property_holder, id, # Uid setters setter_name = 'set' + UpperCase(id) + 'Uid' - setter = Value.UidSetter(setter_name, id, reindex=1) if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, setter) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + setter_name)) property_holder.security.declareProtected(write_permission, setter_name) setter_name = 'setDefault' + UpperCase(id) + 'Uid' - setter = Value.UidDefaultSetter(setter_name, id, reindex=1) if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, setter) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + setter_name)) property_holder.security.declareProtected(write_permission, setter_name) setter_name = 'set' + UpperCase(id) + 'UidList' - setter = Value.UidListSetter(setter_name, id, reindex=1) if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, setter) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + setter_name)) property_holder.security.declareProtected(write_permission, setter_name) setter_name = 'set' + UpperCase(id) + 'UidSet' - setter = Value.UidSetSetter(setter_name, id, reindex=1) if not hasattr(property_holder, setter_name): - setattr(property_holder, setter_name, setter) + setattr(property_holder, setter_name, Alias.Reindex(setter_name, '_' + setter_name)) property_holder.security.declareProtected(write_permission, setter_name) setter_name = '_set' + UpperCase(id) + 'Uid' -- 2.30.9