Ensure id is always available in EvalEnvironment
issue8722 review286051002
This commit is contained in:
1 parent
5c31fb469b
commit
e643af7f20
1 file changed
+4
@@ -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
|
||||
|
||||
Reference in new issue
Block a user