summaryrefslogtreecommitdiff
path: root/examples/adjacencytree/byroot_tree.py
diff options
context:
space:
mode:
authorJason Kirtland <jek@discorporate.us>2007-08-21 21:05:23 +0000
committerJason Kirtland <jek@discorporate.us>2007-08-21 21:05:23 +0000
commit0051349d09a95d48feefc6ebdca832a3919c5817 (patch)
treeb9955e67a533089b8d1743b07dceb6611f28b660 /examples/adjacencytree/byroot_tree.py
parent72efa9db3a2591a36de69158435df9f4bb67ee15 (diff)
downloadsqlalchemy-0051349d09a95d48feefc6ebdca832a3919c5817.tar.gz
Updated adjencytree examples
Diffstat (limited to 'examples/adjacencytree/byroot_tree.py')
-rw-r--r--examples/adjacencytree/byroot_tree.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/adjacencytree/byroot_tree.py b/examples/adjacencytree/byroot_tree.py
index a61bde875..e6e57b5aa 100644
--- a/examples/adjacencytree/byroot_tree.py
+++ b/examples/adjacencytree/byroot_tree.py
@@ -48,7 +48,7 @@ class TreeNode(object):
if isinstance(node, str):
node = TreeNode(node)
node._set_root(self.root)
- self.children.append(node)
+ self.children.set(node)
def __repr__(self):
return self._getstring(0, False)
@@ -90,8 +90,8 @@ class TreeLoader(MapperExtension):
result.append(instance)
else:
if isnew or selectcontext.populate_existing:
- parentnode = selectcontext.identity_map[mapper.identity_key(instance.parent_id)]
- parentnode.children.append(instance)
+ parentnode = selectcontext.identity_map[mapper.identity_key_from_primary_key(instance.parent_id)]
+ parentnode.children.set(instance)
return False
class TreeData(object):
@@ -196,7 +196,7 @@ session.clear()
# load some nodes. we do this based on "root id" which will load an entire sub-tree in one pass.
# the MapperExtension will assemble the incoming nodes into a tree structure.
-t = session.query(TreeNode).select(TreeNode.c.root_id==nodeid, order_by=[TreeNode.c.id])[0]
+t = session.query(TreeNode).filter(TreeNode.c.root_id==nodeid).order_by([TreeNode.c.id])[0]
print "\n\n\n----------------------------"
print "Full Tree:"