Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 70d10d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions nikola/nikola.py
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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()

Expand Down

0 comments on commit 70d10d6

Please sign in to comment.