From e643af7f20ea437dc43d1235e847782d87b481cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 24 Oct 2019 19:00:37 +0200 Subject: [PATCH] Ensure id is always available in EvalEnvironment issue8722 review286051002 --- proteus/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/proteus/__init__.py b/proteus/__init__.py index f977c90098..7e7b5adb94 100644 --- a/proteus/__init__.py +++ b/proteus/__init__.py @@ -27,6 +27,8 @@ class _EvalEnvironment(dict): self.eval_type = eval_type def __getitem__(self, item): + if item == 'id': + return self.parent.id if item == '_parent_' + self.parent._parent_name \ and self.parent._parent: return _EvalEnvironment(self.parent._parent, @@ -58,6 +60,8 @@ class _EvalEnvironment(dict): __repr__ = __str__ def __contains__(self, item): + if item == 'id': + return True if item == '_parent_' + self.parent._parent_name \ and self.parent._parent: return True