Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FakeSignal should stub connect_via method #3208

Merged
merged 1 commit into from May 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.rst
Expand Up @@ -47,6 +47,8 @@ Unreleased
- The return value from :meth:`cli.load_dotenv` is more consistent
with the documentation. It will return ``False`` if python-dotenv is
not installed, or if the given path isn't a file. :issue:`2937`
- Signaling support has a stub for the ``connect_via`` method when
the Blinker library is not installed. :pr:`3208`

.. _#2935: https://github.com/pallets/flask/issues/2935
.. _#2957: https://github.com/pallets/flask/issues/2957
Expand Down
17 changes: 8 additions & 9 deletions flask/signals.py
Expand Up @@ -32,19 +32,18 @@ def __init__(self, name, doc=None):
self.name = name
self.__doc__ = doc

def send(self, *args, **kwargs):
pass

def _fail(self, *args, **kwargs):
raise RuntimeError(
"signalling support is unavailable "
"because the blinker library is "
"not installed."
"Signalling support is unavailable because the blinker"
" library is not installed."
)

send = lambda *a, **kw: None
connect = (
disconnect
) = (
has_receivers_for
) = receivers_for = temporarily_connected_to = connected_to = _fail
connect = connect_via = connected_to = temporarily_connected_to = _fail
disconnect = _fail
has_receivers_for = receivers_for = _fail
del _fail


Expand Down