From fb6b205440d1807346dd65a13e0a374a75677edc Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Sun, 5 Apr 2020 14:23:59 +0200 Subject: [PATCH] StringTree.__getitem__(): Return value child StringTree.__getitem__() returned the node, now return its value child instead. That's nicer and closer to the expected behaviour, as it supports StringTree usage as a key-value store for configuration or so. It breaks the existing API, but I think I have fixed the only pace where it was used: jw-grammar/grammar.py. Signed-off-by: Jan Lindemann --- tools/python/jwutils/stree/StringTree.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/python/jwutils/stree/StringTree.py b/tools/python/jwutils/stree/StringTree.py index 94c239e..bbf4e79 100644 --- a/tools/python/jwutils/stree/StringTree.py +++ b/tools/python/jwutils/stree/StringTree.py @@ -113,7 +113,7 @@ class StringTree: # export r = self.get(path) if r is None: raise KeyError(path) - return r + return r.value() def __setitem__(self, key, value): return self.__set(key, value)