diff --git a/src/nexusformat/nexus/tree.py b/src/nexusformat/nexus/tree.py index 4d252ac..897fd10 100644 --- a/src/nexusformat/nexus/tree.py +++ b/src/nexusformat/nexus/tree.py @@ -1064,11 +1064,22 @@ def tree(self): Returns the directory tree as a string. The tree contains all child objects of this object and their children. - It invokes the 'dir' method with both 'attrs' and 'recursive' set - to True. + It invokes the 'dir' method with 'attrs' set to False and 'recursive' + set to True. """ return self._str_tree(attrs=True, recursive=True) + @property + def short_tree(self): + """ + Returns the directory tree as a string. + + The tree contains all child objects of this object and their children. + It invokes the 'dir' method with 'attrs' set to False and 'recursive' + set to True. + """ + return self._str_tree(attrs=False, recursive=True) + def rename(self, name): if self.nxfilemode == 'r': raise NeXusError('NeXus file opened as readonly') @@ -3263,10 +3274,7 @@ def __unicode__(self): return unicode(self.nxlink) def _str_tree(self, indent=0, attrs=False, recursive=False): - if self.nxlink: - return self.nxlink._str_tree(indent, attrs, recursive) - else: - return " "*indent+self.nxname+' -> '+self._target + return " "*indent+self.nxname+' -> '+self._target def _getlink(self): return self.nxroot[self._target]