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

Add ALL_PAGE_DEPENDENCIES feature to clean up global context #3043

Merged
merged 6 commits into from Apr 17, 2018

Conversation

@Kwpolska
Copy link
Member

@Kwpolska Kwpolska commented Apr 15, 2018

Add ALL_PAGE_DEPENDENCIES feature to clean up global context. As mentioned in #3042 discussion. (The new settings would go in this dict instead of global.)

Or perhaps this should be ALL_TASK_DEPENDENCIES?

Kwpolska added 2 commits Apr 15, 2018
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
@Kwpolska Kwpolska added the minor label Apr 15, 2018
@Kwpolska Kwpolska requested review from ralsina and felixfontein Apr 15, 2018
@Kwpolska Kwpolska added this to the v8.0.0 milestone Apr 15, 2018
nikola/nikola.py Outdated
@@ -2134,6 +2147,7 @@ def generic_renderer(self, lang, output_name, template_name, filters, file_deps=
deps_dict['OUTPUT_FOLDER'] = self.config['OUTPUT_FOLDER']
deps_dict['TRANSLATIONS'] = self.config['TRANSLATIONS']
deps_dict['global'] = self.GLOBAL_CONTEXT
deps_dict["all_page_dependencies"] = self.ALL_PAGE_DEPENDENCIES
Copy link
Contributor

@felixfontein felixfontein Apr 15, 2018

Why not use single quotes here?

Copy link
Member Author

@Kwpolska Kwpolska Apr 15, 2018

Because I copy-pasted from the Atom renderer and didn’t notice the different quotes. Will fix.

@@ -678,8 +681,10 @@ def __init__(self, **config):
'posts_section_name',
'posts_section_title',
'front_index_header',
'rss_path',
Copy link
Contributor

@felixfontein felixfontein Apr 15, 2018

Why are you just moving rss_path? There should be several more.

Copy link
Member Author

@Kwpolska Kwpolska Apr 15, 2018

I didn’t yet bother to look at the list, any specific suggestions?

Copy link
Contributor

@felixfontein felixfontein Apr 15, 2018

Not really (didn't bother either). Except that with updated master, there will be rss_extension, atom_extension and rss_filename_base :)

Copy link
Contributor

@felixfontein felixfontein Apr 15, 2018

Too late, you already did that ;)

nikola/nikola.py Outdated

for k in self._GLOBAL_CONTEXT_TRANSLATABLE:
deps_context[k] = deps_context['global'][k](lang)
for k in self._ALL_PAGE_DEPENDENCIES_TRANSLATABLE:
deps_dict[k] = deps_dict['all_page_dependencies'][k](lang)
Copy link
Contributor

@felixfontein felixfontein Apr 15, 2018

Shouldn't this be

deps_dict['all_page_dependencies'][k] = deps_dict['all_page_dependencies'][k](lang)

?

Copy link
Member Author

@Kwpolska Kwpolska Apr 15, 2018

This is what globals do, so I just copied it. (There are mixed up variable names, I’ll fix that in a while)

Copy link
Contributor

@felixfontein felixfontein Apr 15, 2018

For globals, that made sense because you wanted to have the "real" (i.e. for current language) value. Here, I'm not sure whether we want only the current value, or the whole dict. Having both doesn't make sense, though, I think.

Kwpolska added 2 commits Apr 15, 2018
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
@felixfontein felixfontein mentioned this pull request Apr 17, 2018
3 tasks
@felixfontein
Copy link
Contributor

@felixfontein felixfontein commented Apr 17, 2018

The following variables from global context are not used by any theme bundled with Nikola or inside the https://github.com/getnikola/nikola-themes repository:

SLUG_AUTHOR_PATH
SLUG_TAG_PATH
index_display_post_count
posts_sections
posts_section_are_indexes
posts_sections_are_indexes
posts_section_colors
posts_section_descriptions
posts_section_from_meta
posts_section_name
posts_section_title
sort_posts

I guess sort_posts can definitely stay. About the others, I don't know. The uppercase ones can definitely go, I think. They shouldn't be used in themes, I think.

Kwpolska added 2 commits Apr 17, 2018
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
@Kwpolska
Copy link
Member Author

@Kwpolska Kwpolska commented Apr 17, 2018

The section things could stay, some may be useful in themes. (And sections are going the way of the dodo anyway.) I think i_d_p_c isn’t that bad, and template logic using it is a possibility. The slug things are gone now.

Copy link
Contributor

@felixfontein felixfontein left a comment

Assuming it doesn't break a build, it's good to go from my point of view.

@Kwpolska Kwpolska merged commit 65f10a4 into master Apr 17, 2018
5 checks passed
@Kwpolska Kwpolska deleted the all_page_dependencies branch Apr 17, 2018
@Kwpolska
Copy link
Member Author

@Kwpolska Kwpolska commented Apr 17, 2018

Thanks for reviewing!

felixfontein added a commit to davidak/nikola that referenced this issue Apr 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants