Browse Source

adjust for loop style

pull/2297/head
David Lord 8 years ago
parent
commit
01ddf54b87
No known key found for this signature in database
GPG Key ID: 7A1C87E3F5BC42A8
  1. 4
      CHANGES
  2. 4
      flask/cli.py

4
CHANGES

@ -40,8 +40,8 @@ Major release, unreleased
- Allow IP address as exact session cookie domain. (`#2282`_) - Allow IP address as exact session cookie domain. (`#2282`_)
- ``SESSION_COOKIE_DOMAIN`` is set if it is detected through ``SERVER_NAME``. - ``SESSION_COOKIE_DOMAIN`` is set if it is detected through ``SERVER_NAME``.
(`#2282`_) (`#2282`_)
- Auto-detect 0-argument app factory called ``create_app`` or ``make_app`` from - Auto-detect zero-argument app factory called ``create_app`` or ``make_app``
``FLASK_APP``. (`#2297`_) from ``FLASK_APP``. (`#2297`_)
.. _#1489: https://github.com/pallets/flask/pull/1489 .. _#1489: https://github.com/pallets/flask/pull/1489
.. _#1898: https://github.com/pallets/flask/pull/1898 .. _#1898: https://github.com/pallets/flask/pull/1898

4
flask/cli.py

@ -35,7 +35,7 @@ def find_best_app(module):
from . import Flask from . import Flask
# Search for the most common names first. # Search for the most common names first.
for attr_name in 'app', 'application': for attr_name in ('app', 'application'):
app = getattr(module, attr_name, None) app = getattr(module, attr_name, None)
if isinstance(app, Flask): if isinstance(app, Flask):
return app return app
@ -55,7 +55,7 @@ def find_best_app(module):
) )
# Search for app factory callables. # Search for app factory callables.
for attr_name in 'create_app', 'make_app': for attr_name in ('create_app', 'make_app'):
app_factory = getattr(module, attr_name, None) app_factory = getattr(module, attr_name, None)
if callable(app_factory): if callable(app_factory):

Loading…
Cancel
Save