NodeData class¶
-
class
NodeData
(id=None, parent=None, position=None, properties=None)¶ Immutable data-holding object which represents tree node data. Its attributes are identical to the columns in the
nodes
table (see Database Model).Since the object is immutable, you must retrieve a new instance of the same node using
libtree.core.query.get_node()
to get updated values.To manipulate the values, you must use one of the following functions:
Most
libtree
functions need a database ID in order to know on which data they should operate, but also acceptNode
objects to make handling with them easier.All parameters are optional and default to
None
.Parameters: - id (int) – ID of the node as returned from the database
- parent (Node or int) – Reference to a parent node
- position (int) – Position in between siblings (see Positioning functions)
- properties (dict) – Inheritable key/value pairs (see Property functions)
-
id
¶ Node ID
-
parent
¶ Parent ID
-
position
¶ Position in between its siblings
-
properties
¶ Node properties
-
to_dict
()¶ Return dictionary containing all values of the object.