diff --git a/product/ERP5Type/ERP5Type.py b/product/ERP5Type/ERP5Type.py index a6e03752eda8e167c0dc0acace214422b4becd50..befd918d6eea09643cd0e1dcdb5baaf38a84ab47 100644 --- a/product/ERP5Type/ERP5Type.py +++ b/product/ERP5Type/ERP5Type.py @@ -102,8 +102,10 @@ class LocalRoleAssignorMixIn(object): security.declarePrivate('getFilteredRoleListFor') def getFilteredRoleListFor(self, ob=None): """Return all role generators applicable to the object.""" - ec = createExpressionContext(ob) + ec = None # createExpressionContext is slow so we call it only if needed for role in self.getRoleInformationList(): + if ec is None: + ec = createExpressionContext(ob) if role.testCondition(ec): yield role