comparison piecrust/sources/blogarchives.py @ 1047:ba809c221a27

data: Properly order month names in blog archives.
author Ludovic Chabant <ludovic@chabant.com>
date Fri, 26 Jan 2018 18:00:04 -0800
parents 8adc27285d93
children 5f97b5b59dfe
comparison
equal deleted inserted replaced
1046:aa4f1e04cf3e 1047:ba809c221a27
119 posts_this_month = [] 119 posts_this_month = []
120 month_index[month] = posts_this_month 120 month_index[month] = posts_this_month
121 posts_this_month.append(page.content_item) 121 posts_this_month.append(page.content_item)
122 122
123 self._months = [] 123 self._months = []
124 for m, ptm in month_index.items(): 124 for m in sorted(month_index.keys()):
125 timestamp = time.mktime((self._year, m, 1, 0, 0, 0, 0, 0, -1)) 125 timestamp = time.mktime((self._year, m, 1, 0, 0, 0, 0, 0, -1))
126 126
127 ptm = month_index[m]
127 it = PageIterator(ListSource(self._inner_source, ptm)) 128 it = PageIterator(ListSource(self._inner_source, ptm))
128 it._wrapAsSort(DateSortIterator, reverse=False) 129 it._wrapAsSort(DateSortIterator, reverse=False)
129 130
130 self._months.append({ 131 self._months.append({
131 'timestamp': timestamp, 132 'timestamp': timestamp,