diff --git a/src/datatree.py b/src/datatree.py index 6541f78c..f4c1b66a 100644 --- a/src/datatree.py +++ b/src/datatree.py @@ -208,14 +208,18 @@ def appendNodes(self, data, options, headers=None, delaycommit=False): return False #filter response - if options['nodedata'] is not None: + if options['nodedata'] is None: + subkey = 0 + nodes = data + offcut = None + elif hasDictValue(data,options['nodedata']): subkey = options['nodedata'].rsplit('.', 1)[0] nodes = getDictValue(data, options['nodedata'], False) offcut = filterDictValue(data, options['nodedata'], False) else: - subkey = 0 - nodes = data - offcut = None + subkey = options['nodedata'].rsplit('.', 1)[0] + nodes = [] + offcut = data if not (type(nodes) is list): nodes = [nodes]