Merge pull request #3893 from useblocks/master

Unknown html_theme_options throw warnings instead of errors.
This commit is contained in:
Takeshi KOMIYA 2017-06-26 23:50:52 +09:00 committed by GitHub
commit 2e7cc4c2a1
2 changed files with 7 additions and 4 deletions

View File

@ -133,8 +133,9 @@ class Theme(object):
for option, value in iteritems(overrides):
if option not in options:
raise ThemeError('unsupported theme option %r given' % option)
options[option] = value
logger.warning('unsupported theme option %r given' % option)
else:
options[option] = value
return options

View File

@ -47,8 +47,10 @@ def test_theme_api(app, status, warning):
theme.get_config('theme', 'foobar')
# options API
with pytest.raises(ThemeError):
theme.get_options({'nonexisting': 'foo'})
options = theme.get_options({'nonexisting': 'foo'})
assert 'nonexisting' not in options.keys()
options = theme.get_options(cfg.html_theme_options)
assert options['testopt'] == 'foo'
assert options['nosidebar'] == 'false'