Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3750 — fix TypeError in nikola new_post --available-formats #3751

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Features
Bugfixes
--------

* Fix ``nikola new_post --available-formats`` crashing with TypeError
(Issue #3750)
* Fix the new plugin manager not loading plugins if the plugin folder is a symlink (Issue #3741)
* Fix the ``nikola plugin`` command not working (Issue #3736)

Expand Down
5 changes: 5 additions & 0 deletions nikola/plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class PluginCandidate:

name: str
description: Optional[str]
friendly_name: str
plugin_id: str
category: str
compiler: Optional[str]
Expand All @@ -72,6 +73,7 @@ class PluginInfo:

name: str
description: Optional[str]
friendly_name: str
plugin_id: str
category: str
compiler: Optional[str]
Expand Down Expand Up @@ -129,6 +131,7 @@ def locate_plugins(self) -> List[PluginCandidate]:
continue
category = config["Nikola"].get("PluginCategory")
compiler = config["Nikola"].get("Compiler")
friendly_name = config["Nikola"].get("friendlyname") or name
if not category:
self.logger.warning(f"{plugin_id} does not specify any category (Nikola.PluginCategory is missing in .plugin file) - plugin will not be loaded")
self.has_warnings = True
Expand All @@ -144,6 +147,7 @@ def locate_plugins(self) -> List[PluginCandidate]:
PluginCandidate(
name=name,
description=description,
friendly_name=friendly_name,
plugin_id=plugin_id,
category=category,
compiler=compiler,
Expand Down Expand Up @@ -225,6 +229,7 @@ def load_plugins(self, candidates: List[PluginCandidate]) -> None:
info = PluginInfo(
name=name,
description=candidate.description,
friendly_name=candidate.friendly_name,
plugin_id=candidate.plugin_id,
category=candidate.category,
compiler=candidate.compiler,
Expand Down
18 changes: 7 additions & 11 deletions nikola/plugins/command/new_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,22 +520,18 @@ def print_compilers(self):
False
])

for name, (_, _, pi) in self.site.disabled_compilers.items():
if pi.details.has_option('Nikola', 'Friendlyname'):
f_name = pi.details.get('Nikola', 'Friendlyname')
else:
f_name = name
if name in compilers_raw:
for plugin in self.site.disabled_compilers.values():
if plugin.name in compilers_raw:
unused_compilers.append([
name,
f_name,
compilers_raw[name],
plugin.name,
plugin.friendly_name,
compilers_raw[plugin.name],
False
])
else:
disabled_compilers.append([
name,
f_name,
plugin.name,
plugin.friendly_name,
(),
False
])
Expand Down
Loading