mirror of
https://github.com/mkdocs/mkdocs.git
synced 2026-03-27 09:58:31 +07:00
Let plugins put strings into warnings
even though they should be 2-tuples. Fixes #3014
This commit is contained in:
@@ -996,11 +996,19 @@ class Plugins(OptionallyRequired[plugins.PluginCollection]):
|
||||
if hasattr(plugin, 'on_startup') or hasattr(plugin, 'on_shutdown'):
|
||||
self.plugin_cache[name] = plugin
|
||||
|
||||
errors, warnings = plugin.load_config(
|
||||
errors, warns = plugin.load_config(
|
||||
config, self._config.config_file_path if self._config else None
|
||||
)
|
||||
self.warnings.extend(f"Plugin '{name}' value: '{x}'. Warning: {y}" for x, y in warnings)
|
||||
errors_message = '\n'.join(f"Plugin '{name}' value: '{x}'. Error: {y}" for x, y in errors)
|
||||
for warning in warns:
|
||||
if isinstance(warning, str):
|
||||
self.warnings.append(f"Plugin '{name}'. Warning: {warning}")
|
||||
else:
|
||||
key, msg = warning
|
||||
self.warnings.append(f"Plugin '{name}' value: '{key}'. Warning: {msg}")
|
||||
|
||||
errors_message = '\n'.join(
|
||||
f"Plugin '{name}' value: '{key}'. Error: {msg}" for key, msg in errors
|
||||
)
|
||||
if errors_message:
|
||||
raise ValidationError(errors_message)
|
||||
return plugin
|
||||
|
||||
Reference in New Issue
Block a user