changeset 9b6458a3595f in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=9b6458a3595f
description:
Add get, in_ and contains method to PYSON
issue9576
review319911002
diffstat:
CHANGELOG | 1 +
src/pyson.js | 12 ++++++++++++
2 files changed, 13 insertions(+), 0 deletions(-)
diffs (30 lines):
diff -r 0fafb1c41515 -r 9b6458a3595f CHANGELOG
--- a/CHANGELOG Thu Sep 24 22:43:50 2020 +0200
+++ b/CHANGELOG Thu Sep 24 22:56:58 2020 +0200
@@ -1,3 +1,4 @@
+* Add get, in_ and contains methods to PYSON
* Manage deletable and writable state
* Support e-mail template
* Always encode CSV export in UTF-8
diff -r 0fafb1c41515 -r 9b6458a3595f src/pyson.js
--- a/src/pyson.js Thu Sep 24 22:43:50 2020 +0200
+++ b/src/pyson.js Thu Sep 24 22:56:58 2020 +0200
@@ -29,6 +29,18 @@
types: function() {
throw 'NotImplementedError';
},
+ get: function(k, d) {
+ if (d === undefined) {
+ d = '';
+ }
+ return Sao.PYSON.Get(this, k, d);
+ },
+ in_: function(obj) {
+ return Sao.PYSON.In(this, obj);
+ },
+ contains: function(k) {
+ return Sao.PYSON.In(k, this);
+ },
toString: function() {
var klass = this.pyson().__class__;
var args = this.__string_params__().map(Sao.PYSON.toString);