From: Ben Fagin Date: Fri, 30 Jun 2017 20:36:33 +0000 (-0400) Subject: Add .autocommit to scoped_session X-Git-Tag: rel_1_2_0b1~7^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5c30910759b288d2686a063d1372a33bc6414162;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Add .autocommit to scoped_session Added ``.autocommit`` attribute to :class:`.scoped_session`, proxying the ``.autocommit`` attribute of the underling :class:`.Session` currently assigned to the thread. Pull request courtesy Ben Fagin. Change-Id: Iff741978bd67762f4c7375a23cc151b26192042b Pull-request: https://github.com/zzzeek/sqlalchemy/pull/372 --- diff --git a/doc/build/changelog/changelog_12.rst b/doc/build/changelog/changelog_12.rst index 0c3e3b5db0..34e82504b3 100644 --- a/doc/build/changelog/changelog_12.rst +++ b/doc/build/changelog/changelog_12.rst @@ -13,6 +13,14 @@ .. changelog:: :version: 1.2.0b1 + .. change:: scoped_autocommit + :tags: feature, orm + + Added ``.autocommit`` attribute to :class:`.scoped_session`, proxying + the ``.autocommit`` attribute of the underling :class:`.Session` + currently assigned to the thread. Pull request courtesy + Ben Fagin. + .. change:: 4009 :tags: feature, mysql :tickets: 4009 diff --git a/lib/sqlalchemy/orm/scoping.py b/lib/sqlalchemy/orm/scoping.py index 055ec7d6a1..94a3b40d61 100644 --- a/lib/sqlalchemy/orm/scoping.py +++ b/lib/sqlalchemy/orm/scoping.py @@ -167,7 +167,8 @@ def makeprop(name): return property(get, set) for prop in ('bind', 'dirty', 'deleted', 'new', 'identity_map', - 'is_active', 'autoflush', 'no_autoflush', 'info'): + 'is_active', 'autoflush', 'no_autoflush', 'info', + 'autocommit'): setattr(scoped_session, prop, makeprop(prop))