Commit dbb7fe6a authored by Nicolas Dumazet's avatar Nicolas Dumazet

Be more careful when playing with context=None


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33440 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 921abb60
...@@ -292,6 +292,10 @@ class Resource(XMLMatrix, Variated): ...@@ -292,6 +292,10 @@ class Resource(XMLMatrix, Variated):
If the search returns several candidates due to a relaxed Predicate, If the search returns several candidates due to a relaxed Predicate,
the first item is returned arbitrarily. the first item is returned arbitrarily.
""" """
method = self._getTypeBasedMethod('getDefaultTransformationValue')
if method is not None:
return method(context)
if context is None: if context is None:
transformation_list = self.portal_catalog(portal_type="Transformation", transformation_list = self.portal_catalog(portal_type="Transformation",
resource_category_uid=self.getUid(), resource_category_uid=self.getUid(),
...@@ -299,16 +303,12 @@ class Resource(XMLMatrix, Variated): ...@@ -299,16 +303,12 @@ class Resource(XMLMatrix, Variated):
limit=1) limit=1)
if len(transformation_list) > 0: if len(transformation_list) > 0:
return transformation_list[0].getObject() return transformation_list[0].getObject()
return None
else:
method = context._getTypeBasedMethod('getDefaultTransformationValue') method = context._getTypeBasedMethod('getDefaultTransformationValue')
if method is not None: if method is not None:
return method(context) return method(context)
method = self._getTypeBasedMethod('getDefaultTransformationValue')
if method is not None:
return method(context)
transformation_list = self.portal_domains.searchPredicateList(context, transformation_list = self.portal_domains.searchPredicateList(context,
portal_type="Transformation", portal_type="Transformation",
limit=1) limit=1)
......
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