Mercurial > piecrust2
diff piecrust/appconfig.py @ 743:7705b3d981ca
templating: Make the 'categories' taxonomy use a 'pccaturl' function again.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 03 Jun 2016 20:21:58 -0700 |
parents | 8c3c2b949b82 |
children | 7dbddfed8129 |
line wrap: on
line diff
--- a/piecrust/appconfig.py Thu Jun 02 20:26:51 2016 -0700 +++ b/piecrust/appconfig.py Fri Jun 03 20:21:58 2016 -0700 @@ -14,7 +14,8 @@ from piecrust.cache import NullCache from piecrust.configuration import ( Configuration, ConfigurationError, ConfigurationLoader, - try_get_dict_value, set_dict_value, merge_dicts, visit_dict) + try_get_dict_value, try_get_dict_values, + set_dict_value, merge_dicts, visit_dict) from piecrust.sources.base import REALM_USER, REALM_THEME @@ -373,7 +374,8 @@ 'term': 'tag' }), ('categories', { - 'term': 'category' + 'term': 'category', + 'func_name': 'pccaturl' }) ]) }) @@ -502,18 +504,20 @@ # Route. tax_url_cfg_name = '%s_url' % term - tax_url = blog_cfg.get(tax_url_cfg_name, - try_get_dict_value( - user_overrides, - 'site/%s' % tax_url_cfg_name, - values['site'].get( - tax_url_cfg_name, - '%s/%%%s%%' % (term, term)))) + tax_url = try_get_dict_values( + (blog_cfg, tax_url_cfg_name), + (user_overrides, 'site/%s' % tax_url_cfg_name), + (values, 'site/%s' % tax_url_cfg_name), + default=('%s/%%%s%%' % (term, term))) tax_url = '/' + url_prefix + tax_url.lstrip('/') term_arg = term if tax_cfg.get('multiple') is True: term_arg = '+' + term - tax_func = '%s%surl(%s)' % (tpl_func_prefix, term, term_arg) + tax_func_name = try_get_dict_values( + (user_overrides, 'site/taxonomies/%s/func_name' % tax_name), + (values, 'site/taxonomies/%s/func_name' % tax_name), + default=('%s%surl' % (tpl_func_prefix, term))) + tax_func = '%s(%s)' % (tax_func_name, term_arg) tax_route = collections.OrderedDict({ 'url': tax_url, 'generator': tax_gen_name,