Fix a bug in all_posts generator (first post was not generated)

This commit is contained in:
Gregory Soutade 2014-01-04 13:30:01 +01:00
parent 26fa4b91b9
commit 013dd1a62c

View File

@ -81,7 +81,7 @@ class AllPosts(Index):
cur_posts.append(p) cur_posts.append(p)
# Last month # Last month
if not month_elem is None and len(cur_posts) != 0: if len(cur_posts) != 0:
cur_posts.reverse() cur_posts.reverse()
month_elem = self.createElement(dom, 'month') month_elem = self.createElement(dom, 'month')
month_def = dom.createElement('month') month_def = dom.createElement('month')
@ -129,7 +129,7 @@ class AllPosts(Index):
cur_posts.append(p) cur_posts.append(p)
# Last year # Last year
if not year_elem is None and len(cur_posts) != 0: if len(cur_posts) != 0:
year_elem = self.createElement(dom, 'year') year_elem = self.createElement(dom, 'year')
year_def = dom.createElement('year') year_def = dom.createElement('year')
year_def.appendChild(dom.createTextNode(cur_posts[0].creation_date.strftime(date_format))) year_def.appendChild(dom.createTextNode(cur_posts[0].creation_date.strftime(date_format)))