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

@felixfontein felixfontein commented Dec 8, 2016

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

This comment has been minimized.

@Kwpolska

Kwpolska Dec 9, 2016
Member

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

This comment has been minimized.

@felixfontein

felixfontein Dec 9, 2016
Author Contributor

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

This comment has been minimized.

@felixfontein

felixfontein Dec 9, 2016
Author Contributor

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

This comment has been minimized.

@Kwpolska

Kwpolska Dec 10, 2016
Member

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
5 checks passed
5 checks passed
codacy/pr Good work! A positive pull request.
Details
continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@felixfontein felixfontein deleted the improving-zero-post-indexes branch Dec 10, 2016
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