Skip to content

Commit 70d10d6

Browse files
committedJan 12, 2015
fix #1577 -- don’t classify unpublished posts as pages
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
1 parent a2b615e commit 70d10d6

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed
 

‎CHANGES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Features
6363
Bugfixes
6464
--------
6565

66+
* Don’t classify unpublished posts as pages (Issue #1577)
6667
* Fixed a ``TranslatableSetting.langformat`` race condition
6768
* Fixed ``TranslatableSetting`` instantiation in
6869
``TranslatableSetting.langformat`` (Issue #1571)

‎nikola/nikola.py

+9
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ def __init__(self, **config):
240240
self.strict = False
241241
self.global_data = {}
242242
self.posts = []
243+
self.all_posts = []
243244
self.posts_per_year = defaultdict(list)
244245
self.posts_per_month = defaultdict(list)
245246
self.posts_per_tag = defaultdict(list)
@@ -1272,6 +1273,7 @@ def scan_posts(self, really=False, ignore_quit=False, quiet=False):
12721273
self.commands = None
12731274
self.global_data = {}
12741275
self.posts = []
1276+
self.all_posts = []
12751277
self.posts_per_year = defaultdict(list)
12761278
self.posts_per_month = defaultdict(list)
12771279
self.posts_per_tag = defaultdict(list)
@@ -1354,8 +1356,13 @@ def scan_posts(self, really=False, ignore_quit=False, quiet=False):
13541356
slugged_tags.add(utils.slugify(tag, force=True))
13551357
self.posts_per_tag[tag].append(post)
13561358
self.posts_per_category[post.meta('category')].append(post)
1359+
1360+
if post.is_post:
1361+
# unpublished posts
1362+
self.all_posts.append(post)
13571363
else:
13581364
self.pages.append(post)
1365+
13591366
for lang in self.config['TRANSLATIONS'].keys():
13601367
self.post_per_file[post.destination_path(lang=lang)] = post
13611368
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):
13651372
self.timeline.reverse()
13661373
self.posts.sort(key=lambda p: p.date)
13671374
self.posts.reverse()
1375+
self.all_posts.sort(key=lambda p: p.date)
1376+
self.all_posts.reverse()
13681377
self.pages.sort(key=lambda p: p.date)
13691378
self.pages.reverse()
13701379

0 commit comments

Comments
 (0)
Please sign in to comment.