diff --git a/pelican/tests/test_pelican.py b/pelican/tests/test_pelican.py index 2c7a77be..6816e7a8 100644 --- a/pelican/tests/test_pelican.py +++ b/pelican/tests/test_pelican.py @@ -265,3 +265,21 @@ class TestPelican(LoggedTestCase): sys.executable, '-m', 'pelican', '--help' ]).decode('ascii', 'replace') assert 'usage:' in output + + def test_log_filter(self): + settings = read_settings(path=SAMPLE_CONFIG, override={ + 'PATH': INPUT_PATH, + 'OUTPUT_PATH': self.temp_path, + 'LOCALE': locale.normalize('en_US'), + 'LOG_FILTER': [ + (logging.WARN, 'CATEGORY_SAVE_AS is set to False'), + (logging.WARN, 'AUTHOR_SAVE_AS is set to None'), + ], + 'CATEGORY_SAVE_AS': False, + 'AUTHOR_SAVE_AS': None, + }) + pelican = Pelican(settings=settings) + mute(True)(pelican.run)() + self.assertLogCountEqual( + count=0, # LOG_FILTER should filter out the log messages + level=logging.WARNING) diff --git a/pelican/urlwrappers.py b/pelican/urlwrappers.py index cc276b3f..8ccb62c0 100644 --- a/pelican/urlwrappers.py +++ b/pelican/urlwrappers.py @@ -102,7 +102,7 @@ class URLWrapper(object): setting = "%s_%s" % (self.__class__.__name__.upper(), key) value = self.settings[setting] if not isinstance(value, str): - logger.warning('%s is set to %s', setting, value) + logger.warning('%s is set to %s' % (setting, value)) return value else: if get_page_name: diff --git a/pelican/writers.py b/pelican/writers.py index 7bbd216e..bcae37f0 100644 --- a/pelican/writers.py +++ b/pelican/writers.py @@ -188,6 +188,7 @@ class Writer(object): if name is False or \ name == "" or \ + name is None or \ not is_selected_for_writing(self.settings, os.path.join(self.output_path, name)): return