summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-04-06 19:01:14 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-04-06 19:01:14 +0000
commitdbf936c30b14c81ccaa50a3082181bbdaa4d4d70 (patch)
tree70e3e268da43d3b0ba37c811e1d5563ebb87ec9e /examples
parentccb30be0a28a93f29fbd977da585368db255f554 (diff)
downloadsqlalchemy-dbf936c30b14c81ccaa50a3082181bbdaa4d4d70.tar.gz
added explicit "session" argument to get(), select_whereclause in mapper, as well as throughout the call-chain for those. lazy loader honors the "session" of the parent object, + added simple unit test
Diffstat (limited to 'examples')
-rw-r--r--examples/adjacencytree/byroot_tree.py1
-rw-r--r--examples/polymorph/polymorph2.py6
2 files changed, 4 insertions, 3 deletions
diff --git a/examples/adjacencytree/byroot_tree.py b/examples/adjacencytree/byroot_tree.py
index f564b1f9e..ece90e8d5 100644
--- a/examples/adjacencytree/byroot_tree.py
+++ b/examples/adjacencytree/byroot_tree.py
@@ -45,6 +45,7 @@ class NodeList(util.OrderedDict):
def __iter__(self):
return iter(self.values())
+
class TreeNode(object):
"""a hierarchical Tree class, which adds the concept of a "root node". The root is
the topmost node in a tree, or in other words a node whose parent ID is NULL.
diff --git a/examples/polymorph/polymorph2.py b/examples/polymorph/polymorph2.py
index 8f93fcdfa..351a06eca 100644
--- a/examples/polymorph/polymorph2.py
+++ b/examples/polymorph/polymorph2.py
@@ -86,12 +86,12 @@ class PersonLoader(MapperExtension):
else:
return Person()
- def populate_instance(self, mapper, instance, row, identitykey, imap, isnew):
+ def populate_instance(self, mapper, session, instance, row, identitykey, imap, isnew):
if row[person_join.c.type] =='engineer':
- Engineer.mapper.populate_instance(instance, row, identitykey, imap, isnew, frommapper=mapper)
+ Engineer.mapper.populate_instance(session, instance, row, identitykey, imap, isnew, frommapper=mapper)
return False
elif row[person_join.c.type] =='manager':
- Manager.mapper.populate_instance(instance, row, identitykey, imap, isnew, frommapper=mapper)
+ Manager.mapper.populate_instance(session, instance, row, identitykey, imap, isnew, frommapper=mapper)
return False
else:
return sqlalchemy.mapping.EXT_PASS