changeset b2859b99d2c4 in proteus:default
details: https://hg.tryton.org/proteus?cmd=changeset;node=b2859b99d2c4
description:
        Ensure id is always available in EvalEnvironment

        issue8722
        review286051002
diffstat:

 proteus/__init__.py |  4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diffs (21 lines):

diff -r 28e3d55d7b33 -r b2859b99d2c4 proteus/__init__.py
--- a/proteus/__init__.py       Tue Oct 01 22:54:31 2019 +0200
+++ b/proteus/__init__.py       Thu Oct 24 19:00:37 2019 +0200
@@ -27,6 +27,8 @@
         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 @@
     __repr__ = __str__
 
     def __contains__(self, item):
+        if item == 'id':
+            return True
         if item == '_parent_' + self.parent._parent_name \
                 and self.parent._parent:
             return True

Reply via email to