thats a bug.  its because the flush() is closing the "connection" you
passed to your session.

heres a patch that fixes it, which i will try to commit later today but
i want to work up some test cases:

Index: lib/sqlalchemy/orm/session.py
===================================================================
--- lib/sqlalchemy/orm/session.py       (revision 1852)
+++ lib/sqlalchemy/orm/session.py       (working copy)
@@ -37,7 +37,7 @@
         e = connectable.engine
         c = connectable.contextual_connect()
         if not self.connections.has_key(e):
-            self.connections[e] = (c, c.begin())
+            self.connections[e] = (c, c.begin(), c is not connectable)
         return self.connections[e][0]
     def commit(self):
         if self.parent is not None:
@@ -58,7 +58,8 @@
         if self.parent is not None:
             return
         for t in self.connections.values():
-            t[0].close()
+                if (t[2]):
+                    t[0].close()
         self.session.transaction = None
 
 class Session(object):


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sqlalchemy
-~----------~----~----~----~------~----~------~--~---

Reply via email to