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
Attempting to fix #2496. #2695
Attempting to fix #2496. #2695
Conversation
The last commit should fix the texts, but also induces a potentially backwards compatibility breaking change in case a post scanner plugin needs the final The only way to avoid this is probably to get rid of the bad compilers optimization completely. This would also make all the new code superfluous and simplify logic a lot. |
@ralsina: any thoughts and comments? |
1d1712d
to
2120fa5
Compare
@felixfontein I might not have enough time for a review until the weekend. |
nikola/plugins/misc/scan_posts.py
Outdated
|
||
def supported_extensions(self): | ||
"""Return a list of supported file extensions, or None if such a list isn't known beforehand.""" | ||
return list(set([os.path.splitext(x[0])[1] for x in self.site.config['post_pages']])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be made simpler. Since we dropped 2.6 support, you can use set comprehensions ({i for i in x}
). And even if we didn’t, using a generator expression inside set(i for i in x)
would look better.
return list({os.path.splitext(x[0])[1] for x in self.site.config['post_pages']})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
nikola/nikola.py
Outdated
@@ -1729,7 +1759,7 @@ def generic_rss_feed(self, lang, title, link, description, timeline, | |||
post.date.astimezone(dateutil.tz.tzutc())), | |||
'categories': post._tags.get(lang, []), | |||
'creator': post.author(lang), | |||
'guid': post.guid(lang), | |||
'guid': post.permalink(lang, absolute=True), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this intentional or are those just some leftovers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are definitely leftovers!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like that was the only one which got in. I've removed it by now.
@Kwpolska: take your time! A couple of days more don't really matter ;) |
nikola/nikola.py
Outdated
self.disabled_compiler_extensions = defaultdict(list) | ||
self.bad_compilers = set([]) | ||
for k, v in compilers.items(): | ||
# self.config['COMPILERS'][k] = sorted(list(v)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This requires a comment to explain (and shouldn’t have commented-out code)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a leftover from the original code. I've removed it and simplified the thing.
utils.LOGGER.debug('Not loading compiler extension {}', p[-1].name) | ||
if to_add: | ||
self.plugin_manager._candidates = self._filter_duplicate_plugins(to_add) | ||
self.plugin_manager.loadPlugins() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are plugins loaded through here activated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Until that point, only plugins of type PostScanner
have been activated, and all others not. Since we only added plugins of type PageCompiler
or compiler extensions (plugins having compiler
set) no plugin should be forgotten.
(Except if a post scanner plugin has compiler
set in its .plugin
file. I assumed such plugins don't exist.)
nikola/nikola.py
Outdated
compilers[compiler].add(candidate) | ||
|
||
# Avoid redundant compilers | ||
# Remove compilers that match nothing in POSTS/PAGES |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use an explanation of how we gather the compilers, and perhaps a better name than bad_compilers
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed bad_compilers
, since the same information is already contained in disabled_compilers
and nothing in core or plugins
was using it.
Is the explanation in 53e5f6e good enough, or do you want something more detailed?
LGTM. How much testing have you done? Have you tested it with some other PostScanner plugin? |
I've tested it with my pages and blogs; they all use the hierarchical pages post scanner plugin (https://plugins.getnikola.com/v7/hierarchical_pages/), and one of them another post scanner plugin I'm currently working on. So far it seems to work fine. |
(I'm using a slightly adjusted version of the hierarchical pages plugin which defines |
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
It works fine in both cases (tested with the plugins site). Merging. |
Thanks for merging! |
fixes #2496. closes #2498 (superseeded by this).