changeset fb62f70ec995 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset&node=fb62f70ec995
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
        review376551002
diffstat:

 src/pyson.js |  13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r 25650912aa20 -r fb62f70ec995 src/pyson.js
--- a/src/pyson.js      Sun Jan 30 13:02:31 2022 +0100
+++ b/src/pyson.js      Sun Jan 30 13:10:57 2022 +0100
@@ -168,7 +168,18 @@
         },
         __string_params__: function() {
             return [this._value, this._default];
-        }
+        },
+        get basename() {
+            var name = this._value;
+            if (name.startsWith('_parent_')) {
+                name = name.slice('_parent_'.length);
+            }
+            var idx = name.indexOf('.');
+            if (idx >= 0) {
+                name = name.substring(0, idx);
+            }
+            return name;
+        },
     });
 
     Sao.PYSON.Eval.eval_ = function(value, context) {

Reply via email to