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

        issue8722
        review286051002
        (grafted from b2859b99d2c49b0cb5427196f235c051aba62cd9)
diffstat:

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

diffs (21 lines):

diff -r 4c3b2c50dd28 -r b17edeb050f5 proteus/__init__.py
--- a/proteus/__init__.py       Thu Oct 24 00:21:35 2019 +0200
+++ b/proteus/__init__.py       Thu Oct 24 19:00:37 2019 +0200
@@ -25,6 +25,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,
@@ -56,6 +58,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