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

Ensuring that generic_index_render always works fine with an empty post list #2586

Merged
merged 2 commits into from Dec 10, 2016

Conversation

felixfontein
Copy link
Contributor

When INDEXES_STATIC == False, an empty post list results in no generated pages for generic_index_renderer. You can see this when building an empty site with INDEXES_STATIC == False: no index.html is generated.

num_pages = len(lists)
displayed_page_numbers = [utils.get_displayed_page_number(i, num_pages, self) for i in range(num_pages or 1)]
assert num_pages >= 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assertions are ugly and can be disabled, use an if and raise an exception yourself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, I'd rather remove that line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I don't understand why the other asserts are OK then, though.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 6 uses of assert in the codebase, and I guess we should get rid of those.

@felixfontein felixfontein merged commit 6e1ccb8 into master Dec 10, 2016
@felixfontein felixfontein deleted the improving-zero-post-indexes branch December 10, 2016 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants