# HG changeset patch # User Ludovic Chabant # Date 1413439341 25200 # Node ID 438509f1233278445576c4f0178cc1989573fdf7 # Parent b6ec402d32bb356e4747ab6e72da6596236358d9 Fix post sources datetimes by adding missing metadata when in "find" mode. diff -r b6ec402d32bb -r 438509f12332 piecrust/sources/posts.py --- 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