diff --git a/product/ERP5Type/Utils.py b/product/ERP5Type/Utils.py index 1bcb22da5562c14c5ab7311e5a31673dc6ac686b..2ef40914a6f19559e9a03ee7338478ec1a6d84a7 100644 --- a/product/ERP5Type/Utils.py +++ b/product/ERP5Type/Utils.py @@ -999,10 +999,13 @@ def setDefaultConstructor(klass): document_constructor.__name__ = document_constructor_name -def createExpressionContext(object, portal): +def createExpressionContext(object, portal=None): """ Return a context used for evaluating a TALES expression. """ + if portal is None and object is not None: + portal = object.getPortalObject() + if object is None or getattr(object, 'aq_base', None) is None: folder = portal else: