Skip to content
Permalink
Browse files

Added docstrings and fixed typo.

  • Loading branch information
felixfontein committed Sep 10, 2015
1 parent 168d1e4 commit ff6a71ba8b70ba069283a1e6a86027061734e8d9
Showing with 7 additions and 1 deletion.
  1. +7 −1 nikola/plugins/task/indexes.py
@@ -55,12 +55,18 @@ def set_site(self, site):
return super(Indexes, self).set_site(site)

def _get_filtered_posts(self, lang, show_untranslated_posts):
"""Return a filtered list of all posts for the given language.
If show_untranslated_posts is True, will only include posts which
are translated to the given language. Otherwise, returns all posts.
"""
if show_untranslated_posts:
return self.site.posts
else:
return [x for x in self.site.posts if x.is_translation_available(lang)]

def _compute_number_of_pages(self, filtered_posts, posts_count):
"""Given a list of posts and the maximal number of posts per page, computes the number of pages needed."""
return min(1, (len(filtered_posts) + posts_count - 1) // posts_count)

def gen_tasks(self):
@@ -242,7 +248,7 @@ def index_path(self, name, lang, is_feed=False):
self.site.config['INDEX_PATH'],
index_file] if _f],
name,
utils.get_displayed_page_number(name, self.number_of_pages, self.site),
utils.get_displayed_page_number(name, number_of_pages, self.site),
lang,
self.site,
extension=extension)

0 comments on commit ff6a71b

Please sign in to comment.