Mercurial > piecrust2
diff piecrust/sources/posts.py @ 109:438509f12332
Fix post sources datetimes by adding missing metadata when in "find" mode.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 15 Oct 2014 23:02:21 -0700 |
parents | d74ae33832ae |
children | f130365568ff |
line wrap: on
line diff
--- a/piecrust/sources/posts.py Wed Oct 15 23:01:43 2014 -0700 +++ b/piecrust/sources/posts.py Wed Oct 15 23:02:21 2014 -0700 @@ -99,12 +99,19 @@ if not m: raise Exception("Expected to be able to match path with path " "format: %s" % path) + + year = int(m.group('year')) + month = int(m.group('month')) + day = int(m.group('day')) + timestamp = datetime.date(year, month, day) fac_metadata = { - 'year': m.group('year'), - 'month': m.group('month'), - 'day': m.group('day'), - 'slug': m.group('slug') + 'year': year, + 'month': month, + 'day': day, + 'slug': m.group('slug'), + 'date': timestamp } + rel_path = os.path.relpath(path, self.fs_endpoint_path) rel_path = rel_path.replace('\\', '/') return rel_path, fac_metadata