Greetings, I'm looking into building a tree structure using SQLObject. Prior to using SQLObject, I was using a modified preorder tree structure. I'd like to continue this approach, and have found several posts from others on this list who took that path as well. One approach appears to be wrapped into the Alinea project (http://svn.pythonfr.org/public/alinea/Alinea/AlineaLib/AlineaNode.py). Another approach was proposed by Ben Bangert (http://pastebin.com/372150).
I'm trying to compare the two approaches (in an attempt to not reinvent the wheel). However, pastebin seems to have long since dropped any references to 372150 and I can't find it cached anywhere. Does anyone have a pointer to that sample code? Many thanks, James > On Sep 23, 2005, at 11:14 AM, Philippe Normand wrote: > > > I also read the link you gave above (sitepoint), and cooked up a class > > to implement a Modified Preorder tree structure, see: > > > > http://svn.pythonfr.org/public/alinea/Alinea/AlineaLib/AlineaNode.py > > > > > > Actually the code is not (that) specific to Alinea and could be reused > > by others ... > > > > Please close your eyes and don't read the code of "moveTo" method, > > it's > > really ugly ;( In fact moving nodes in such a tree structure is not > > trivial, if you have a smart solution let me see :) > > I'm still putting together unit tests to ensure it works, but I do > have a appendChild (move) function that does significantly less > queries than your version to move a node that contains children to > have a new parent node. I have no idea how long pastebin.com history > lasts, so better look sooner than later: > > http://pastebin.com/372150 > > Thats my code to deal with the Modified Preorder tree. In my limited > interactive testing, it is moving and closing gaps properly in the > few dozen cases I've manually tested. > > As there's no quick way to reliably remove the cache for all objects > in the class (is there?), the table inheriting from it should have > cacheValues set to False. Enhancements to that code are very > appreciated. :) > ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642 _______________________________________________ sqlobject-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
