diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-09-30 04:40:15 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-09-30 04:40:15 +0000 |
commit | d117a15020aedabdd7726a0e4bd9018e44717dbd (patch) | |
tree | fa18a44502afa2aa93945621cc96bc3ec96b40a0 /examples/adjacencytree/byroot_tree.py | |
parent | 3c19b41b603d53741f1f0e911fbba95c6667a7a3 (diff) | |
download | sqlalchemy-d117a15020aedabdd7726a0e4bd9018e44717dbd.tar.gz |
- 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.
Diffstat (limited to 'examples/adjacencytree/byroot_tree.py')
-rw-r--r-- | examples/adjacencytree/byroot_tree.py | 7 |
1 files changed, 4 insertions, 3 deletions
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): |