Mercurial > piecrust2
diff piecrust/data/paginationdata.py @ 912:cd236a6af9f6
data: Add access to route metadata in the templating data.
It's available under `route`.
Also, rename `slug` to `rel_url`, because it's confusing when `slug` could
be the route metadata of the same name as provided by the default page source.
The old `slug` is still there for backwards compatibility though.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 28 Apr 2017 10:05:14 -0700 |
parents | a12ad254176e |
children | b447c24bc8d4 |
line wrap: on
line diff
--- a/piecrust/data/paginationdata.py Sat Apr 29 21:42:22 2017 -0700 +++ b/piecrust/data/paginationdata.py Fri Apr 28 10:05:14 2017 -0700 @@ -1,3 +1,4 @@ +import copy import time import logging from piecrust.data.assetor import Assetor @@ -31,9 +32,11 @@ page = self._page dt = page.datetime page_url = self._get_uri() - _, slug = split_uri(page.app, page_url) + _, rel_url = split_uri(page.app, page_url) self._setValue('url', page_url) - self._setValue('slug', slug) + self._setValue('rel_url', rel_url) + self._setValue('slug', rel_url) # For backwards compatibility + self._setValue('route', copy.deepcopy(self._route_metadata)) self._setValue( 'timestamp', time.mktime(page.datetime.timetuple()))