changeset 94c886cf2e44 in proteus:4.8
details: https://hg.tryton.org/proteus?cmd=changeset;node=94c886cf2e44
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 1a6afb40f307 -r 94c886cf2e44 proteus/__init__.py
--- a/proteus/__init__.py       Thu Oct 24 00:22:35 2019 +0200
+++ b/proteus/__init__.py       Thu Oct 24 19:00:37 2019 +0200
@@ -34,6 +34,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,
@@ -65,6 +67,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