[Erp5-report] r41691 yusei - /erp5/trunk/products/ERP5/Document/MappedValue.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Dec 23 03:48:25 CET 2010
Author: yusei
Date: Thu Dec 23 03:48:23 2010
New Revision: 41691
URL: http://svn.erp5.org?rev=41691&view=rev
Log:
Remove redefined xxxProperty methods and revert to the previous
behavior. When a property is defined by a property sheet with a
specific storage_id, they break accessors of this property when a
value is mapped to it. And then, for example, a value user entered
through matrixbox and a value indexed by catalog becomes
different. This causes a serious problem. Thus, we need this fix.
Modified:
erp5/trunk/products/ERP5/Document/MappedValue.py
Modified: erp5/trunk/products/ERP5/Document/MappedValue.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/MappedValue.py?rev=41691&r1=41690&r2=41691&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/MappedValue.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/MappedValue.py [utf8] Thu Dec 23 03:48:23 2010
@@ -29,7 +29,6 @@
import zope.interface
from AccessControl import ClassSecurityInfo
-from Acquisition import aq_base
from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.Core.Predicate import Predicate
@@ -39,10 +38,6 @@ _MARKER = []
class MappedValue(Predicate):
"""
A MappedValue allows to associate a value to a predicate
-
- XXX Why do we redefine xxxProperty methods ?
- When a property is defined by a property sheet with a specific storage_id,
- they break accessors of this property when a value is mapped to it.
"""
meta_type = 'ERP5 Mapped Value'
portal_type = 'Mapped Value'
@@ -77,66 +72,6 @@ class MappedValue(Predicate):
return self._baseGetMappedValueBaseCategoryList(d=d)
return self._baseGetMappedValueBaseCategoryList()
- security.declareProtected( Permissions.AccessContentsInformation, 'getProperty' )
- def getProperty(self, key, d=_MARKER, **kw):
- """
- Use local property instead of calling (acquired) accessor
- whenever key is provided by the mapped value.
-
- TODO:
- - handle list properties (key ends with _list)
- - add unit tests
- """
- if key in self.getMappedValuePropertyList():
- result = getattr(aq_base(self), key, _MARKER)
- if result is not _MARKER:
- return result
- if d is _MARKER:
- return Predicate.getProperty(self, key, **kw) # XXX-JPS I would prefer to use always getProperty
- # Is there any reason to overload ?
- return Predicate.getProperty(self, key, d=d, **kw)
-
- def getPropertyList(self, key, d=None):
- """
- Use local property instead of calling (acquired) accessor
- whenever key is provided by the mapped value.
-
- TODO:
- - add unit tests
- """
- if key in self.getMappedValuePropertyList():
- result = getattr(aq_base(self), key, _MARKER)
- if result is not _MARKER:
- return result
- if d is None:
- return Predicate.getPropertyList(self, key)
- return Predicate.getPropertyList(self, key, d=d)
-
- def _setProperty(self, key, value, type=None, **kw):
- """
- Use local property instead of calling (acquired) accessor
- whenever key is provided by the mapped value.
-
- TODO:
- - handle type
- - add unit tests
- """
- if key in self.getMappedValuePropertyList():
- return setattr(self, key, value)
- return Predicate._setProperty(self, key, value, type=type, **kw)
-
- # Check is this method should also be overriden
- #def _setPropValue(self, key, value, **kw):
-
- def hasProperty(self, key):
- """
- Use local property instead of calling (acquired) accessor
- whenever key is provided by the mapped value.
- """
- if key in self.getMappedValuePropertyList():
- return getattr(self, key, _MARKER) is not _MARKER
- return Predicate.hasProperty(self, key)
-
def _edit(self, **kw):
# We must first prepare the mapped value before we do the edit
edit_order = ['mapped_value_property_list',
More information about the Erp5-report
mailing list