File tree Expand file tree Collapse file tree 4 files changed +37
-9
lines changed Expand file tree Collapse file tree 4 files changed +37
-9
lines changed Original file line number Diff line number Diff line change
1
+ Version 2.4.3
2
+ -------------
3
+
4
+ Unreleased
5
+
6
+ - Deprecate ``SQLALCHEMY_COMMIT_ON_TEARDOWN `` as it can cause various
7
+ design issues that are difficult to debug. Call
8
+ ``db.session.commit() `` directly instead. :issue: `216 `
9
+
10
+
1
11
Version 2.4.2
2
12
-------------
3
13
4
14
Released 2020-05-25
5
15
6
16
- Fix bad pagination when records are de-duped. :pr: `812 `
7
17
18
+
8
19
Version 2.4.1
9
20
-------------
10
21
Original file line number Diff line number Diff line change @@ -98,15 +98,17 @@ A list of configuration keys currently understood by the extension:
98
98
``SQLALCHEMY_TRACK_MODIFICATIONS `` will warn if unset.
99
99
100
100
.. versionchanged :: 2.4
101
+ * ``SQLALCHEMY_ENGINE_OPTIONS `` configuration key was added.
102
+ * Deprecated keys
101
103
102
- * ``SQLALCHEMY_ENGINE_OPTIONS `` configuration key was added.
103
- * Deprecated keys
104
+ * ``SQLALCHEMY_NATIVE_UNICODE ``
105
+ * ``SQLALCHEMY_POOL_SIZE ``
106
+ * ``SQLALCHEMY_POOL_TIMEOUT ``
107
+ * ``SQLALCHEMY_POOL_RECYCLE ``
108
+ * ``SQLALCHEMY_MAX_OVERFLOW ``
104
109
105
- * ``SQLALCHEMY_NATIVE_UNICODE ``
106
- * ``SQLALCHEMY_POOL_SIZE ``
107
- * ``SQLALCHEMY_POOL_TIMEOUT ``
108
- * ``SQLALCHEMY_POOL_RECYCLE ``
109
- * ``SQLALCHEMY_MAX_OVERFLOW ``
110
+ .. versionchanged :: 2.4.3
111
+ Deprecated ``SQLALCHEMY_COMMIT_ON_TEARDOWN ``.
110
112
111
113
112
114
Connection URI Format
Original file line number Diff line number Diff line change @@ -694,6 +694,10 @@ class to be used in place of :class:`Model`.
694
694
695
695
.. versionchanged:: 2.4
696
696
The `use_native_unicode` parameter was deprecated.
697
+
698
+ .. versionchanged:: 2.4.3
699
+ ``COMMIT_ON_TEARDOWN`` is deprecated and will be removed in
700
+ version 3.1. Call ``db.session.commit()`` directly instead.
697
701
"""
698
702
699
703
#: Default query class used by :attr:`Model.query` and other queries.
@@ -843,6 +847,13 @@ def init_app(self, app):
843
847
@app .teardown_appcontext
844
848
def shutdown_session (response_or_exc ):
845
849
if app .config ['SQLALCHEMY_COMMIT_ON_TEARDOWN' ]:
850
+ warnings .warn (
851
+ "'COMMIT_ON_TEARDOWN' is deprecated and will be"
852
+ " removed in version 3.1. Call"
853
+ " 'db.session.commit()'` directly instead." ,
854
+ DeprecationWarning ,
855
+ )
856
+
846
857
if response_or_exc is None :
847
858
self .session .commit ()
848
859
Original file line number Diff line number Diff line change @@ -22,12 +22,16 @@ def create():
22
22
23
23
24
24
def test_commit_on_success (client ):
25
- resp = client .post ('/create' )
25
+ with pytest .warns (DeprecationWarning , match = "COMMIT_ON_TEARDOWN" ):
26
+ resp = client .post ('/create' )
27
+
26
28
assert resp .status_code == 200
27
29
assert client .get ('/' ).data == b'Test one'
28
30
29
31
30
32
def test_roll_back_on_failure (client ):
31
- resp = client .post ('/create' , data = {'fail' : 'on' })
33
+ with pytest .warns (DeprecationWarning , match = "COMMIT_ON_TEARDOWN" ):
34
+ resp = client .post ('/create' , data = {'fail' : 'on' })
35
+
32
36
assert resp .status_code == 500
33
37
assert client .get ('/' ).data == b''
You can’t perform that action at this time.
0 commit comments