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
Accept a page
argument for taxonomy paths
#2589
Conversation
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
page_info = None | ||
if not taxonomy.show_list_as_index and page is not None: | ||
if taxonomy.show_list_as_index and page is not None: |
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.
Thanks for fixing that bug.
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.
LGTM except for Atom path handler.
@@ -269,15 +269,21 @@ def _taxonomy_index_path(self, name, lang, taxonomy): | |||
path, append_index, _ = self._parse_path_result(result) | |||
return self._postprocess_path(path, lang, append_index=append_index, dest_type='list') | |||
|
|||
def _taxonomy_path(self, name, lang, taxonomy, dest_type='page'): | |||
def _taxonomy_path(self, name, lang, taxonomy, dest_type='page', page=None): |
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.
You also need a page=None
argument for _taxonomy_atom_path
(which must be passed to _taxonomy_path
).
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.
Ah, and in line 247 it should be dest_type in ('page', 'feed')
and not dest_type == 'page'
.
There was another problem in |
The last commit shows how this actually can simplify things. (And it is a test case that the whole thing actually works.) |
The last commit (00acea8) isn't completely good. In case the setting How about keeping the new code, but only in |
(“make it work” should be the top priority, not “make it look good”) |
Well, before the commit it worked well, so reverting the commit is a simple solution. On the other hand, I also like to avoid writing logic twice, and using I guess undoing the commit is the simplest solution which makes it work, though. |
… indexes." as that commit doesn't work with INDEXES_PRETTY_PAGE_URL. This reverts commit 00acea8.
I decided to undo the commit. (I also fixed an unrelated typo.) |
Oh, another idea: how to add an additional argument to the path handler (like |
… path handlers for taxonomy plugins.
of two integers: the page number and the number of pages. This will | ||
be used to append the correct page number by calling | ||
`utils.adjust_name_for_index_path_list` and | ||
`utils.get_displayed_page_number`. | ||
|
||
If `alternative_path` is set to `True`, `utils.adjust_name_for_index_path_list` |
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.
What makes it alternative?
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.
It is not the default path (parmalink), but an alternative path. Or it can be; in most cases it's the same.
Do you have a better idea for a name?
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.
You should explain what the difference would be in the docstring.
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 added a very short explanation. (I want to avoid repeating the logic of adjust_name_for_index_path_list
here.)
@ralsina, any review? |
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.
Quick review LGTM
Thanks! |
This is #2585, cc @felixfontein. Note the change in the
if
for pagination — did I just fix a bug or was it intended?