From d117a15020aedabdd7726a0e4bd9018e44717dbd Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 30 Sep 2006 04:40:15 +0000 Subject: - internal refactoring to mapper instances() method to use a SelectionContext object to track state during the operation. SLIGHT API BREAKAGE: the append_result() and populate_instances() methods on MapperExtension have a slightly different method signature now as a result of the change; hoping that these methods are not in widespread use as of yet. --- examples/adjacencytree/byroot_tree.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'examples/adjacencytree') diff --git a/examples/adjacencytree/byroot_tree.py b/examples/adjacencytree/byroot_tree.py index d19171051..48793b936 100644 --- a/examples/adjacencytree/byroot_tree.py +++ b/examples/adjacencytree/byroot_tree.py @@ -91,7 +91,8 @@ class TreeLoader(MapperExtension): if instance.root is instance: connection.execute(mapper.mapped_table.update(TreeNode.c.id==instance.id, values=dict(root_node_id=instance.id))) instance.root_id = instance.id - def append_result(self, mapper, session, row, imap, result, instance, isnew, populate_existing=False): + + def append_result(self, mapper, selectcontext, row, instance, identitykey, result, isnew): """runs as results from a SELECT statement are processed, and newly created or already-existing instances that correspond to each row are appended to result lists. This method will only append root nodes to the result list, and will attach child nodes to their appropriate parent @@ -101,8 +102,8 @@ class TreeLoader(MapperExtension): result.append(instance) else: if isnew or populate_existing: - parentnode = imap[mapper.identity_key(instance.parent_id)] - parentnode.children.append(instance, _mapper_nohistory=True) + parentnode = selectcontext.identity_map[mapper.identity_key(instance.parent_id)] + parentnode.children.append_without_event(instance) return False class TreeData(object): -- cgit v1.2.1