Browse Source

silence ENOTDIR when loading config file

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

8
CHANGES

@ -3,6 +3,7 @@ Flask Changelog
Here you can see the full list of changes between each Flask release. Here you can see the full list of changes between each Flask release.
Version 0.13 Version 0.13
------------ ------------
@ -114,7 +115,9 @@ Major release, unreleased
depending on ``app.debug``. No handlers are removed, and a handler is only depending on ``app.debug``. No handlers are removed, and a handler is only
added if no handlers are already configured. (`#2436`_) added if no handlers are already configured. (`#2436`_)
- Blueprint view function name may not contain dots. (`#2450`_) - Blueprint view function name may not contain dots. (`#2450`_)
- The dev server now uses threads by default. - The dev server now uses threads by default. (`#2529`_)
- Loading config files with ``silent=True`` will ignore ``ENOTDIR``
errors. (`#2581`_)
.. _pallets/meta#24: https://github.com/pallets/meta/issues/24 .. _pallets/meta#24: https://github.com/pallets/meta/issues/24
.. _#1421: https://github.com/pallets/flask/issues/1421 .. _#1421: https://github.com/pallets/flask/issues/1421
@ -149,6 +152,9 @@ Major release, unreleased
.. _#2430: https://github.com/pallets/flask/pull/2430 .. _#2430: https://github.com/pallets/flask/pull/2430
.. _#2436: https://github.com/pallets/flask/pull/2436 .. _#2436: https://github.com/pallets/flask/pull/2436
.. _#2450: https://github.com/pallets/flask/pull/2450 .. _#2450: https://github.com/pallets/flask/pull/2450
.. _#2529: https://github.com/pallets/flask/pull/2529
.. _#2581: https://github.com/pallets/flask/pull/2581
Version 0.12.3 Version 0.12.3
-------------- --------------

4
flask/config.py

@ -129,7 +129,9 @@ class Config(dict):
with open(filename, mode='rb') as config_file: with open(filename, mode='rb') as config_file:
exec(compile(config_file.read(), filename, 'exec'), d.__dict__) exec(compile(config_file.read(), filename, 'exec'), d.__dict__)
except IOError as e: except IOError as e:
if silent and e.errno in (errno.ENOENT, errno.EISDIR): if silent and e.errno in (
errno.ENOENT, errno.EISDIR, errno.ENOTDIR
):
return False return False
e.strerror = 'Unable to load configuration file (%s)' % e.strerror e.strerror = 'Unable to load configuration file (%s)' % e.strerror
raise raise

Loading…
Cancel
Save