Mercurial > piecrust2
diff piecrust/data/pagedata.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 | cc2647360036 |
children |
line wrap: on
line diff
--- a/piecrust/data/pagedata.py Sun Oct 29 22:46:41 2017 -0700 +++ b/piecrust/data/pagedata.py Sun Oct 29 22:51:57 2017 -0700 @@ -1,3 +1,4 @@ +import copy import time import logging import collections.abc @@ -165,13 +166,21 @@ self._ctx = ctx def _load(self): + from piecrust.uriutil import split_uri + page = self._page set_val = self._setValue + page_url = page.getUri(self._ctx.sub_num) + _, rel_url = split_uri(page.app, page_url) + dt = page.datetime for k, v in page.source_metadata.items(): set_val(k, v) - set_val('url', page.getUri(self._ctx.sub_num)) + set_val('url', page_url) + set_val('rel_url', rel_url) + set_val('route', copy.deepcopy(page.source_metadata['route_params'])) + set_val('timestamp', time.mktime(dt.timetuple())) set_val('datetime', { 'year': dt.year, 'month': dt.month, 'day': dt.day,