Commit fe15de55 authored by Romain Courteaud's avatar Romain Courteaud

Add query parameter to _getRelated[...] methods.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13436 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6f44d763
...@@ -1575,60 +1575,72 @@ class Base( CopyContainer, ...@@ -1575,60 +1575,72 @@ class Base( CopyContainer,
security.declareProtected( Permissions.View, '_getDefaultRelatedValue' ) security.declareProtected( Permissions.View, '_getDefaultRelatedValue' )
def _getDefaultRelatedValue(self, id, spec=(), filter=None, portal_type=(), def _getDefaultRelatedValue(self, id, spec=(), filter=None, portal_type=(),
strict_membership=0, strict="deprecated"): strict_membership=0, strict="deprecated",
query=None):
# backward compatibility to keep strict keyword working # backward compatibility to keep strict keyword working
if strict != "deprecated" : strict_membership = strict if strict != "deprecated" :
value_list =self._getRelatedValueList(id, spec=spec, filter=filter, strict_membership = strict
value_list =self._getRelatedValueList(
id, spec=spec, filter=filter,
portal_type=portal_type, portal_type=portal_type,
strict_membership=strict_membership) strict_membership=strict_membership,
query=query)
try: try:
return value_list[0] return value_list[0]
except IndexError: except IndexError:
return None return None
security.declareProtected( Permissions.View, 'getDefaultRelatedValue' ) security.declareProtected(Permissions.View, 'getDefaultRelatedValue')
getDefaultRelatedValue = _getDefaultRelatedValue getDefaultRelatedValue = _getDefaultRelatedValue
security.declareProtected( Permissions.View, '_getRelatedValueList' ) security.declareProtected( Permissions.View, '_getRelatedValueList' )
def _getRelatedValueList(self, id, spec=(), filter=None, portal_type=(), def _getRelatedValueList(self, id, spec=(), filter=None, portal_type=(),
strict_membership=0, strict="deprecated"): strict_membership=0, strict="deprecated",
query=None):
# backward compatibility to keep strict keyword working # backward compatibility to keep strict keyword working
if strict != "deprecated" : strict_membership = strict if strict != "deprecated" :
return self._getCategoryTool().getRelatedValueList(self, id, strict_membership = strict
return self._getCategoryTool().getRelatedValueList(
self, id,
spec=spec, filter=filter, portal_type=portal_type, spec=spec, filter=filter, portal_type=portal_type,
strict_membership=strict_membership) strict_membership=strict_membership,
query=query)
security.declareProtected( Permissions.View, 'getRelatedValueList' ) security.declareProtected(Permissions.View, 'getRelatedValueList')
getRelatedValueList = _getRelatedValueList getRelatedValueList = _getRelatedValueList
security.declareProtected( Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'_getDefaultRelatedProperty' ) '_getDefaultRelatedProperty')
def _getDefaultRelatedProperty(self, id, property_name, spec=(), filter=None, def _getDefaultRelatedProperty(self, id, property_name, spec=(), filter=None,
portal_type=(), strict_membership=0): portal_type=(), strict_membership=0,
query=None):
property_list = self._getCategoryTool().getRelatedPropertyList(self, id, property_list = self._getCategoryTool().getRelatedPropertyList(self, id,
property_name=property_name, property_name=property_name,
spec=spec, filter=filter, spec=spec, filter=filter,
portal_type=portal_type, portal_type=portal_type,
strict_membership=strict_membership) strict_membership=strict_membership,
query=query)
try: try:
return property_list[0] return property_list[0]
except IndexError: except IndexError:
return None return None
security.declareProtected( Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getDefaultRelatedProperty' ) 'getDefaultRelatedProperty')
getDefaultRelatedProperty = _getDefaultRelatedProperty getDefaultRelatedProperty = _getDefaultRelatedProperty
security.declareProtected( Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'_getRelatedPropertyList' ) '_getRelatedPropertyList')
def _getRelatedPropertyList(self, id, property_name, spec=(), filter=None, def _getRelatedPropertyList(self, id, property_name, spec=(), filter=None,
portal_type=(), strict_membership=0): portal_type=(), strict_membership=0,
query=None):
return self._getCategoryTool().getRelatedPropertyList(self, id, return self._getCategoryTool().getRelatedPropertyList(self, id,
property_name=property_name, property_name=property_name,
spec=spec, filter=filter, spec=spec, filter=filter,
portal_type=portal_type, portal_type=portal_type,
strict_membership=strict_membership) strict_membership=strict_membership,
query=query)
security.declareProtected( Permissions.AccessContentsInformation, security.declareProtected( Permissions.AccessContentsInformation,
'getRelatedPropertyList' ) 'getRelatedPropertyList' )
......
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