mirror of
https://github.com/mkdocs/mkdocs.git
synced 2026-03-27 09:58:31 +07:00
Prevent a confusing stack trace when theme config fails validation
Caused by previous commit. When, for example, the chosen theme is not installed, a stack trace would be shown instead of a proper error. Because then somehow the theme config remains a dict but validation moves on anyway.
This commit is contained in:
@@ -966,7 +966,7 @@ class Plugins(OptionallyRequired[plugins.PluginCollection]):
|
||||
else:
|
||||
# Attempt to load with prepended namespace for the current theme.
|
||||
if self.theme_key and self._config:
|
||||
current_theme = self._config[self.theme_key].name
|
||||
current_theme = self._config[self.theme_key]['name']
|
||||
if current_theme:
|
||||
expanded_name = f'{current_theme}/{name}'
|
||||
if expanded_name in self.installed_plugins:
|
||||
|
||||
@@ -31,7 +31,7 @@ class Theme:
|
||||
|
||||
def __init__(self, name: Optional[str] = None, **user_config) -> None:
|
||||
self.name = name
|
||||
self._vars = {'locale': 'en'}
|
||||
self._vars = {'name': name, 'locale': 'en'}
|
||||
|
||||
# MkDocs provided static templates are always included
|
||||
package_dir = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
Reference in New Issue
Block a user