Commit bc634b05 authored by Jérome Perrin's avatar Jérome Perrin

rename keyword strict to strict_membership in category membership generated methods. (Bug #42)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3293 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b124000a
......@@ -43,6 +43,8 @@ class DefaultGetter(Method):
func_defaults = ()
def __init__(self, id, key, warning=0):
""" 'warning' argument means that this category is deprecated in the
property sheet, so the generated method will also be deprecated """
self._id = id
self.__name__ = id
self._key = key
......@@ -54,7 +56,9 @@ class DefaultGetter(Method):
return instance._getDefaultRelatedValue(self._key,
spec=kw.get('spec',()),
filter=kw.get('filter', None),
portal_type=kw.get('portal_type',()))
portal_type=kw.get('portal_type',()),
strict_membership=kw.get('strict_membership',
kw.get('strict', None))) # 'strict' is deprecated
psyco.bind(__call__)
......@@ -74,6 +78,8 @@ class ListGetter(Method):
func_defaults = ()
def __init__(self, id, key, warning=0):
""" 'warning' argument means that this category is deprecated in the
property sheet, so the generated method will also be deprecated """
self._id = id
self.__name__ = id
self._key = key
......@@ -85,7 +91,9 @@ class ListGetter(Method):
return instance._getRelatedValueList(self._key,
spec=kw.get('spec',()),
filter=kw.get('filter', None),
portal_type=kw.get('portal_type',()))
portal_type=kw.get('portal_type',()),
strict_membership=kw.get('strict_membership',
kw.get('strict', None))) # 'strict' is deprecated
psyco.bind(__call__)
......@@ -116,7 +124,10 @@ class DefaultIdGetter(Method):
return instance._getDefaultRelatedProperty(self._key, 'id',
spec=kw.get('spec',()),
filter=kw.get('filter', None),
portal_type=kw.get('portal_type',()))
portal_type=kw.get('portal_type',()),
strict_membership=kw.get('strict_membership',
kw.get('strict', None))) # 'strict' is deprecated
psyco.bind(__call__)
......@@ -147,7 +158,9 @@ class IdListGetter(Method):
return instance._getRelatedPropertyList(self._key, 'id',
spec=kw.get('spec',()),
filter=kw.get('filter', None),
portal_type=kw.get('portal_type',()))
portal_type=kw.get('portal_type',()),
strict_membership=kw.get('strict_membership',
kw.get('strict', None))) # 'strict' is deprecated
psyco.bind(__call__)
......@@ -178,7 +191,10 @@ class DefaultTitleGetter(Method):
return instance._getDefaultRelatedProperty(self._key, 'title',
spec=kw.get('spec',()),
filter=kw.get('filter', None),
portal_type=kw.get('portal_type',()))
portal_type=kw.get('portal_type',(),
strict_membership=kw.get('strict_membership',
kw.get('strict', None))) # 'strict' is deprecated
psyco.bind(__call__)
......@@ -209,8 +225,9 @@ class TitleListGetter(Method):
return instance._getRelatedPropertyList(self._key, 'title',
spec=kw.get('spec',()),
filter=kw.get('filter', None),
portal_type=kw.get('portal_type',()))
portal_type=kw.get('portal_type',()),
strict_membership=kw.get('strict_membership',
kw.get('strict', None))) # 'strict' is deprecated
psyco.bind(__call__)
TitleSetGetter = TitleListGetter # XXX Error
......@@ -240,8 +257,9 @@ class DefaultPropertyGetter(Method):
return instance._getDefaultRelatedProperty(self._key, key,
spec=kw.get('spec',()),
filter=kw.get('filter', None),
portal_type=kw.get('portal_type',()))
portal_type=kw.get('portal_type',()),
strict_membership=kw.get('strict_membership',
kw.get('strict', None))) # 'strict' is deprecated
psyco.bind(__call__)
PropertyGetter = DefaultPropertyGetter
......@@ -271,8 +289,9 @@ class PropertyListGetter(Method):
return instance._getRelatedPropertyList(self._key, key,
spec=kw.get('spec',()),
filter=kw.get('filter', None),
portal_type=kw.get('portal_type',()))
portal_type=kw.get('portal_type',()),
strict_membership=kw.get('strict_membership',
kw.get('strict', None))) # 'strict' is deprecated
psyco.bind(__call__)
PropertySetGetter = PropertyListGetter # Error XXX
......@@ -1192,20 +1192,29 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
getAcquiredValueList = _getAcquiredValueList
security.declareProtected( Permissions.View, '_getDefaultRelatedValue' )
def _getDefaultRelatedValue(self, id, spec=(), filter=None, portal_type=(), strict=0):
value_list =self._getRelatedValueList(id, spec=spec, filter=filter, portal_type=portal_type, strict=strict)
def _getDefaultRelatedValue(self, id, spec=(), filter=None, portal_type=(),
strict_membership=0, strict="deprecated"):
# backward compatibility to keep strict keyword working
if strict != "deprecated" : strict_membership = strict
value_list =self._getRelatedValueList(id, spec=spec, filter=filter,
portal_type=portal_type,
strict_membership=strict_membership)
try:
return value_list[0]
except:
except IndexError:
return None
security.declareProtected( Permissions.View, 'getDefaultRelatedValue' )
getDefaultRelatedValue = _getDefaultRelatedValue
security.declareProtected( Permissions.View, '_getRelatedValueList' )
def _getRelatedValueList(self, id, spec=(), filter=None, portal_type=(), strict=0):
def _getRelatedValueList(self, id, spec=(), filter=None, portal_type=(),
strict_membership=0, strict="deprecated"):
# backward compatibility to keep strict keyword working
if strict != "deprecated" : strict_membership = strict
return self._getCategoryTool().getRelatedValueList(self, id,
spec=spec, filter=filter, portal_type=portal_type, strict=strict)
spec=spec, filter=filter, portal_type=portal_type,
strict_membership=strict_membership)
security.declareProtected( Permissions.View, 'getRelatedValueList' )
getRelatedValueList = _getRelatedValueList
......
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