Issue #37 resolved

ns_tree is_root implementation

Jaap Roes
created an issue

Currently there is no custom //is_root// method for //NS_Nodes//. Calls to //is_root// therefore fall back to the default implementation of //is_root// in //Node//.

The default implementation of //is_root// calls //get_root// and compares it to //self//. For //NS_Nodes// this means that every //is_root// call for non root nodes will end up retrieving the actual root node from the database.

The method //get_root// in ns_tree nodes actually already contains code to quickly identify if a node is a root node. (//if self.lft == 1//)

//NS_Node// should thus get a custom implementation of //is_root// (//is_root = lambda self: self.lft == 1//). This could also makes //NS_Node// traversing a bit faster.

Comments (2)

  1. Log in to comment