Skip to content

Commit

Permalink
Merge pull request #16 from miohtama/master
Browse files Browse the repository at this point in the history
Support SQLAlchemy 1.1
  • Loading branch information
mgedmin committed Apr 25, 2016
2 parents 88fc883 + 9119ca8 commit 1c35615
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Changes
0.7.7 (unreleased)
------------------

* Support SQLAlchemy 1.1.

See: https://github.com/zopefoundation/zope.sqlalchemy/issues/15

0.7.6 (2015-03-20)
------------------

Expand Down
8 changes: 7 additions & 1 deletion src/zope/sqlalchemy/datamanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ class SessionDataManager(object):

def __init__(self, session, status, transaction_manager, keep_session=False):
self.transaction_manager = transaction_manager
self.tx = session.transaction._iterate_parents()[-1]

# Support both SQLAlchemy 1.0 and 1.1
# https://github.com/zopefoundation/zope.sqlalchemy/issues/15
_iterate_parents = getattr(session.transaction, "_iterate_self_and_parents", None) \
or session.transaction._iterate_parents

self.tx = _iterate_parents()[-1]
self.session = session
transaction_manager.get().join(self)
_SESSION_STATE[id(session)] = status
Expand Down

0 comments on commit 1c35615

Please sign in to comment.