[Checkins] SVN: zope.sqlalchemy/trunk/s use the new after_attach
hook. Should we now depend on 0.5beta3?
Laurence Rowe
l at lrowe.co.uk
Fri Jul 18 16:26:11 EDT 2008
Log message for revision 88543:
use the new after_attach hook. Should we now depend on 0.5beta3?
Changed:
U zope.sqlalchemy/trunk/setup.py
U zope.sqlalchemy/trunk/src/zope/sqlalchemy/datamanager.py
U zope.sqlalchemy/trunk/src/zope/sqlalchemy/tests.py
-=-
Modified: zope.sqlalchemy/trunk/setup.py
===================================================================
--- zope.sqlalchemy/trunk/setup.py 2008-07-18 19:54:44 UTC (rev 88542)
+++ zope.sqlalchemy/trunk/setup.py 2008-07-18 20:26:11 UTC (rev 88543)
@@ -79,7 +79,7 @@
install_requires=[
'setuptools',
- 'SQLAlchemy>=0.4.6',
+ 'SQLAlchemy>=0.5.0beta3dev-r4954',
'transaction',
'zope.interface',
],
Modified: zope.sqlalchemy/trunk/src/zope/sqlalchemy/datamanager.py
===================================================================
--- zope.sqlalchemy/trunk/src/zope/sqlalchemy/datamanager.py 2008-07-18 19:54:44 UTC (rev 88542)
+++ zope.sqlalchemy/trunk/src/zope/sqlalchemy/datamanager.py 2008-07-18 20:26:11 UTC (rev 88543)
@@ -179,6 +179,9 @@
def after_begin(self, session, transaction, connection):
join_transaction(session, self.initial_state)
+ def after_attach(self, session, instance):
+ join_transaction(session, self.initial_state)
+
def after_flush(self, session, flush_context):
invalidate(session)
Modified: zope.sqlalchemy/trunk/src/zope/sqlalchemy/tests.py
===================================================================
--- zope.sqlalchemy/trunk/src/zope/sqlalchemy/tests.py 2008-07-18 19:54:44 UTC (rev 88542)
+++ zope.sqlalchemy/trunk/src/zope/sqlalchemy/tests.py 2008-07-18 20:26:11 UTC (rev 88543)
@@ -204,6 +204,13 @@
t = transaction.get()
self.failIf([r for r in t._resources if isinstance(r, tx.SessionDataManager)],
"Joined transaction too early")
+ session = Session()
+ session.save(User(id=1, firstname='udo', lastname='juergens'))
+ t = transaction.get()
+ # Expect this to fail with SQLAlchemy 0.4
+ self.failUnless([r for r in t._resources if isinstance(r, tx.SessionDataManager)],
+ "Not joined transaction")
+ transaction.abort()
conn = Session().connection()
self.failUnless([r for r in t._resources if isinstance(r, tx.SessionDataManager)],
"Not joined transaction")
More information about the Checkins
mailing list