Skip to content

Commit f02c6af

Browse files
committed
clean up signal docs
fix py3 print in doc config
1 parent 10cf167 commit f02c6af

File tree

3 files changed

+33
-32
lines changed

3 files changed

+33
-32
lines changed

docs/conf.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@
5151
try:
5252
release = pkg_resources.get_distribution('Flask-SQLAlchemy').version
5353
except pkg_resources.DistributionNotFound:
54-
print 'To build the documentation, The distribution information of'
55-
print 'Flask-SQLAlchemy has to be available. Either install the package'
56-
print 'into your development environment or run "setup.py develop"'
57-
print 'to setup the metadata. A virtualenv is recommended!'
54+
print('To build the documentation, The distribution information of')
55+
print('Flask-SQLAlchemy has to be available. Either install the package')
56+
print('into your development environment or run "setup.py develop"')
57+
print('to setup the metadata. A virtualenv is recommended!')
5858
sys.exit(1)
5959
del pkg_resources
6060

@@ -232,13 +232,13 @@
232232
# fall back if theme is not there
233233
try:
234234
__import__('flask_theme_support')
235-
except ImportError, e:
236-
print '-' * 74
237-
print 'Warning: Flask themes unavailable. Building with default theme'
238-
print 'If you want the Flask themes, run this command and build again:'
239-
print
240-
print ' git submodule update --init'
241-
print '-' * 74
235+
except ImportError as e:
236+
print('-' * 74)
237+
print('Warning: Flask themes unavailable. Building with default theme')
238+
print('If you want the Flask themes, run this command and build again:')
239+
print()
240+
print(' git submodule update --init')
241+
print('-' * 74)
242242

243243
pygments_style = 'tango'
244244
html_theme = 'default'

docs/config.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ A list of configuration keys currently understood by the extension:
5353
its maximum size. When those additional
5454
connections are returned to the pool,
5555
they are disconnected and discarded.
56-
``SQLALCHEMY_TRACK_MODIFICATIONS`` If set to `True` (the default)
57-
Flask-SQLAlchemy will track
58-
modifications of objects and emit
59-
signals. This requires extra memory
60-
and can be disabled if not needed.
56+
``SQLALCHEMY_TRACK_MODIFICATIONS`` If set to ``True``, Flask-SQLAlchemy will
57+
track modifications of objects and emit
58+
signals. The default is ``None``, which
59+
enables tracking but issues a warning
60+
that it will be disabled by default in
61+
the future. This requires extra memory
62+
and should be disabled if not needed.
6163
================================== =========================================
6264

6365
.. versionadded:: 0.8
@@ -73,6 +75,8 @@ A list of configuration keys currently understood by the extension:
7375

7476
.. versionadded:: 2.0
7577
The ``SQLALCHEMY_TRACK_MODIFICATIONS`` configuration key was added.
78+
.. versionchanged:: 2.1
79+
``SQLALCHEMY_TRACK_MODIFICATIONS`` will warn if unset.
7680

7781
Connection URI Format
7882
---------------------

docs/signals.rst

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
11
Signalling Support
22
==================
33

4-
.. versionadded:: 0.10
5-
6-
Starting with Flask-SQLAlchemy 0.10 you can now connect to signals to get
7-
notifications when certain things happen.
4+
Connect to the following signals to get notified before and after changes are committed to the database.
5+
These changes are only tracked if ``SQLALCHEMY_TRACK_MODIFICATIONS`` is enabled in the config.
86

9-
The following two signals exist:
7+
.. versionadded:: 0.10
8+
.. versionchanged:: 2.1
9+
``before_models_committed`` is triggered correctly.
10+
.. deprecated:: 2.1
11+
This will be disabled by default in a future version.
1012

1113
.. data:: models_committed
1214

13-
This signal is sent when changed models were committed to the
14-
database. The sender is the application that emitted the changes
15-
and the models and an operation identifier are passed as list of tuples
16-
in the form ``(model, operation)`` to the receiver in the `changes`
17-
parameter.
15+
This signal is sent when changed models were committed to the database.
16+
17+
The sender is the application that emitted the changes.
18+
The receiver is passed the ``changes`` parameter with a list of tuples in the form ``(model instance, operation)``.
1819

19-
The model is the instance of the model that was sent to the database
20-
and the operation is ``'insert'`` when a model was inserted,
21-
``'delete'`` when the model was deleted and ``'update'`` if any
22-
of the columns where updated.
20+
The operation is one of ``'insert'``, ``'update'``, and ``'delete'``.
2321

2422
.. data:: before_models_committed
2523

26-
Works exactly the same as :data:`models_committed` but is emitted
27-
right before the committing takes place.
24+
This signal works exactly like :data:`models_committed` but is emitted before the commit takes place.

0 commit comments

Comments
 (0)