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):
If the search returns several candidates due to a relaxed Predicate,
the first item is returned arbitrarily.
"""
method = self._getTypeBasedMethod('getDefaultTransformationValue')
if method is not None:
return method(context)
if context is None:
transformation_list = self.portal_catalog(portal_type="Transformation",
resource_category_uid=self.getUid(),
......@@ -299,13 +303,9 @@ class Resource(XMLMatrix, Variated):
limit=1)
if len(transformation_list) > 0:
return transformation_list[0].getObject()
return None
else:
method = context._getTypeBasedMethod('getDefaultTransformationValue')
if method is not None:
return method(context)
method = self._getTypeBasedMethod('getDefaultTransformationValue')
method = context._getTypeBasedMethod('getDefaultTransformationValue')
if method is not None:
return method(context)
......
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