From 06f96df67e291caeaeb09ad296aa368c80cc1a58 Mon Sep 17 00:00:00 2001 From: David Lord Date: Fri, 5 Jan 2018 07:40:51 -0800 Subject: [PATCH] silence ENOTDIR when loading config file --- CHANGES | 8 +++++++- flask/config.py | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 11fb7df2..3517f1a7 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ Flask Changelog Here you can see the full list of changes between each Flask release. + Version 0.13 ------------ @@ -114,7 +115,9 @@ Major release, unreleased depending on ``app.debug``. No handlers are removed, and a handler is only added if no handlers are already configured. (`#2436`_) - 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 .. _#1421: https://github.com/pallets/flask/issues/1421 @@ -149,6 +152,9 @@ Major release, unreleased .. _#2430: https://github.com/pallets/flask/pull/2430 .. _#2436: https://github.com/pallets/flask/pull/2436 .. _#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 -------------- diff --git a/flask/config.py b/flask/config.py index 697add71..f73a4232 100644 --- a/flask/config.py +++ b/flask/config.py @@ -129,7 +129,9 @@ class Config(dict): with open(filename, mode='rb') as config_file: exec(compile(config_file.read(), filename, 'exec'), d.__dict__) 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 e.strerror = 'Unable to load configuration file (%s)' % e.strerror raise