diff piecrust/sources/posts.py @ 244:ba857c693c72

sources: Fix a bug where the `posts` source wasn't correctly parsing URLs. Don't crash when a component is missing from the URL and we have to recapture.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 19 Feb 2015 19:55:09 -0800
parents f130365568ff
children 0641fe5c3ef9
line wrap: on
line diff
--- a/piecrust/sources/posts.py	Thu Feb 19 08:09:17 2015 -0800
+++ b/piecrust/sources/posts.py	Thu Feb 19 19:55:09 2015 -0800
@@ -53,9 +53,9 @@
                 ext = self.default_auto_format
 
         replacements = {
-                'year': '%04d' % year,
-                'month': '%02d' % month,
-                'day': '%02d' % day,
+                'year': '%04d' % year if year is not None else None,
+                'month': '%02d' % month if month is not None else None,
+                'day': '%02d' % day if day is not None else None,
                 'slug': slug,
                 'ext': ext
                 }