Mercurial > piecrust2
comparison 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 |
comparison
equal
deleted
inserted
replaced
243:26e59f837558 | 244:ba857c693c72 |
---|---|
51 ext = self.supported_extensions[0] | 51 ext = self.supported_extensions[0] |
52 elif mode == MODE_CREATING and self.default_auto_format: | 52 elif mode == MODE_CREATING and self.default_auto_format: |
53 ext = self.default_auto_format | 53 ext = self.default_auto_format |
54 | 54 |
55 replacements = { | 55 replacements = { |
56 'year': '%04d' % year, | 56 'year': '%04d' % year if year is not None else None, |
57 'month': '%02d' % month, | 57 'month': '%02d' % month if month is not None else None, |
58 'day': '%02d' % day, | 58 'day': '%02d' % day if day is not None else None, |
59 'slug': slug, | 59 'slug': slug, |
60 'ext': ext | 60 'ext': ext |
61 } | 61 } |
62 needs_recapture = False | 62 needs_recapture = False |
63 if year is None: | 63 if year is None: |