diff piecrust/dataproviders/blog.py @ 979:45ad976712ec

tests: Big push to get the tests to pass again. - Lots of fixes everywhere in the code. - Try to handle debug logging in the multiprocessing worker pool when running in pytest. Not perfect, but usable for now. - Replace all `.md` test files with `.html` since now a auto-format extension always sets the format. - Replace `out` with `outfiles` in most places since now blog archives are added to the bake output and I don't want to add expected outputs for blog archives everywhere.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 29 Oct 2017 22:51:57 -0700
parents 1d0364614665
children 492b66482f12
line wrap: on
line diff
--- a/piecrust/dataproviders/blog.py	Sun Oct 29 22:46:41 2017 -0700
+++ b/piecrust/dataproviders/blog.py	Sun Oct 29 22:51:57 2017 -0700
@@ -56,7 +56,8 @@
     def __iter__(self):
         self._buildPosts()
         self._buildArchives()
-        return ['posts', 'years', 'months'] + list(self._taxonomies.keys())
+        return ['posts', 'years', 'months'] + list(
+            sorted(self._taxonomies.keys()))
 
     def __len__(self):
         self._buildPosts()
@@ -111,7 +112,7 @@
                     (post_dt.year, post_dt.month, 1,
                      0, 0, 0, 0, 0, -1))
                 posts_this_month = BlogArchiveEntry(
-                    source, page, month, timestamp)
+                    source, page, month[0], timestamp)
                 monthly_index[month] = posts_this_month
             posts_this_month._items.append(post.content_item)
 
@@ -144,7 +145,8 @@
 
         self._taxonomies = {}
         for tax_name, entries in tax_index.items():
-            self._taxonomies[tax_name] = list(entries.values())
+            self._taxonomies[tax_name] = list(
+                sorted(entries.values(), key=lambda i: i.term))
 
         self._onIteration(None)
 
@@ -171,7 +173,7 @@
         self._iterator = None
 
     def __str__(self):
-        return self.name
+        return str(self.name)
 
     def __int__(self):
         return int(self.name)