On Sep 23, 2005, at 11:35 AM, Philippe Normand wrote:

Why don't you use the InheritableSQLObject class to implement your
SQLObjectNestedSet ?

Then you could end up with something like:

class Comments(SQLObjectNestedSet):
    name = StringCol(length=50)
    time = DateTimeCol(default=datetime.now)
    comment = StringCol()

e,g, deport lft and rgt attributes to SQLObjectNestedSet. You wouldn't
need a "parent" attribute because it's easy to guess using lft and rgt.

Hmm, hadn't thought of that. Looks good. By the way, the code I pasted there will die a horrible death if you turn cacheValues to off. I have fixed that, and tested again. I also added a bit to toss an exception if someone tries appending the parent (or any ancestors) of a node, to the node.

Here's the new code:


- Ben