Closed rob-vh closed 5 months ago
I could fix this by calling super().__init__(tree)
to load the tree-dict into the real dict, instead of the .tree
attribute.
Then:
r.ownertree
in ipython would return a str representation of the (real) dict__list__()
Now... do I need 2 methods to specify the format, or not?
t.ownertree.setformat('simple')
would return the real dict. should I make this a "returns nothing" method, that only influences the default formatting format?r.ownertree.format('simple')
that produces the desired output, same as print(r.ownertree)
does?https://github.com/wizardofzos/pyracf/pull/29/commits/f8b5c2ad774e86b1ca62a5bd8d44e81ee73e3ee6
r.ownergroup
now returns the raw dict of the tree. The .tree
attribute is deleted.
r.ownergroup.setformat(format='simple')
no longer returns the formatted tree, it only sets the default format for the next print(r.ownertree)
command.
new method r.ownertree.format()
returns the formatted tree, same as produced by print(r.ownertree)
. Optional parameter format={'unix', 'simple'}
When you issue
r.ownertree
in ipython, you acually getr.ownertree.__repr__()
. This prints{}
because.tree
attribute isprint(r.ownertree)
, you invoke ther.ownertree.__lst__()
and this pretty-prints the tree If you need the tree dict object, documentation states you should user.ownertree.tree