Mercurial > piecrust2
changeset 734:3f01f63b7247
routing: Correctly call the underlying route template function from a merged one.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 01 Jun 2016 22:19:01 -0700 |
parents | 40aaec6d1d85 |
children | 6c500fd3194f |
files | piecrust/routing.py tests/bakes/test_multiblog.yaml |
diffstat | 2 files changed, 9 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/piecrust/routing.py Wed Jun 01 22:11:51 2016 -0700 +++ b/piecrust/routing.py Wed Jun 01 22:19:01 2016 -0700 @@ -361,7 +361,7 @@ f_args = args[:-1] for r, f in self._funcs: if r.source_name == args[-1]: - return f(f_args, **kwargs) + return f(*f_args, **kwargs) raise Exception("No such source: %s" % args[-1]) raise Exception("Incorrect number of arguments for route function. "
--- a/tests/bakes/test_multiblog.yaml Wed Jun 01 22:11:51 2016 -0700 +++ b/tests/bakes/test_multiblog.yaml Wed Jun 01 22:19:01 2016 -0700 @@ -5,8 +5,8 @@ in: posts/one/2016-01-01_post1.html: '' posts/two/2016-01-02_post2.html: '' - pages/foo-one.html: "Link: {{pcposturl(2016, 01, 01, 'post1', 'one')}}" - pages/foo-two.html: "Link: {{pcposturl(2016, 01, 02, 'post2', 'two')}}" + pages/foo-one.html: "Link: {{pconeposturl(2016, 01, 01, 'post1')}}" + pages/foo-two.html: "Link: {{pctwoposturl(2016, 01, 02, 'post2')}}" outfiles: foo-one.html: "Link: /one/2016/01/01/post1.html" foo-two.html: "Link: /two/2016/01/02/post2.html" @@ -14,11 +14,15 @@ config: site: blogs: [one, two] + one: + func_prefix: pc + two: + func_prefix: pc in: posts/one/2016-01-01_post1.html: '' posts/two/2016-01-02_post2.html: '' - pages/foo-one.html: "---\nblog: one\n---\nLink: {{pcposturl(2016, 01, 01, 'post1')}}" - pages/foo-two.html: "---\nblog: two\n---\nLink: {{pcposturl(2016, 01, 02, 'post2')}}" + pages/foo-one.html: "---\nblog: one\n---\nLink: {{pcposturl(2016, 01, 01, 'post1', 'one')}}" + pages/foo-two.html: "---\nblog: two\n---\nLink: {{pcposturl(2016, 01, 02, 'post2', 'two')}}" outfiles: foo-one.html: "Link: /one/2016/01/01/post1.html" foo-two.html: "Link: /two/2016/01/02/post2.html"