Skip to content
Permalink
Browse files

fix #1577 -- don’t classify unpublished posts as pages

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information...
Kwpolska committed Jan 12, 2015
1 parent a2b615e commit 70d10d62c6244dc6f8bf2530cade6b7a77d9548c
Showing with 10 additions and 0 deletions.
  1. +1 −0 CHANGES.txt
  2. +9 −0 nikola/nikola.py
@@ -63,6 +63,7 @@ Features
Bugfixes
--------

* Don’t classify unpublished posts as pages (Issue #1577)
* Fixed a ``TranslatableSetting.langformat`` race condition
* Fixed ``TranslatableSetting`` instantiation in
``TranslatableSetting.langformat`` (Issue #1571)
@@ -240,6 +240,7 @@ def __init__(self, **config):
self.strict = False
self.global_data = {}
self.posts = []
self.all_posts = []
self.posts_per_year = defaultdict(list)
self.posts_per_month = defaultdict(list)
self.posts_per_tag = defaultdict(list)
@@ -1272,6 +1273,7 @@ def scan_posts(self, really=False, ignore_quit=False, quiet=False):
self.commands = None
self.global_data = {}
self.posts = []
self.all_posts = []
self.posts_per_year = defaultdict(list)
self.posts_per_month = defaultdict(list)
self.posts_per_tag = defaultdict(list)
@@ -1354,8 +1356,13 @@ def scan_posts(self, really=False, ignore_quit=False, quiet=False):
slugged_tags.add(utils.slugify(tag, force=True))
self.posts_per_tag[tag].append(post)
self.posts_per_category[post.meta('category')].append(post)

if post.is_post:
# unpublished posts
self.all_posts.append(post)
else:
self.pages.append(post)

for lang in self.config['TRANSLATIONS'].keys():
self.post_per_file[post.destination_path(lang=lang)] = post
self.post_per_file[post.destination_path(lang=lang, extension=post.source_ext())] = post
@@ -1365,6 +1372,8 @@ def scan_posts(self, really=False, ignore_quit=False, quiet=False):
self.timeline.reverse()
self.posts.sort(key=lambda p: p.date)
self.posts.reverse()
self.all_posts.sort(key=lambda p: p.date)
self.all_posts.reverse()
self.pages.sort(key=lambda p: p.date)
self.pages.reverse()

0 comments on commit 70d10d6

Please sign in to comment.
You can’t perform that action at this time.