changeset a0f8aac350a2 in proteus:default
details: https://hg.tryton.org/proteus?cmd=changeset&node=a0f8aac350a2
description:
        Use simplified parser for get_eval_fields

        Instead of using the PYSONEncoder we can just iterate over the basic 
JSON types
        and use the pyson method to retrieve nested PYSON instances.

        issue11164
diffstat:

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

diffs (19 lines):

diff -r c338576b9eae -r a0f8aac350a2 proteus/pyson.py
--- a/proteus/pyson.py  Mon Jan 03 22:37:15 2022 +0100
+++ b/proteus/pyson.py  Tue Feb 22 18:04:31 2022 +0100
@@ -162,6 +162,15 @@
                     }, context.get(base) or {})
         return context.get(dct['v'], dct['d'])
 
+    @property
+    def basename(self):
+        name = self._value
+        if name.startswith('_parent_'):
+            name = name[len('_parent_'):]
+        if '.' in name:
+            name = name.split('.', 1)[0]
+        return name
+
 
 class Not(PYSON):
 

Reply via email to