From 5fb4825268d2574a28a27b8da3c40b92a4a74e38 Mon Sep 17 00:00:00 2001 From: Thomas Bechtold Date: Mon, 10 Oct 2016 14:28:15 +0200 Subject: [PATCH] Remove filter for license We have the context function which can be used with: {{ license('Apache-2.0') }} and this function is already used in all templates. So remove the "old-style" license handling. Change-Id: Ia7f1cc0ec004696949f36b86f982f76ad358871e --- doc/source/usage.rst | 4 ++-- renderspec/__init__.py | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/doc/source/usage.rst b/doc/source/usage.rst index e9bf0f9..4ff5741 100644 --- a/doc/source/usage.rst +++ b/doc/source/usage.rst @@ -148,12 +148,12 @@ With an existing yaml (and `oslo.config` epoch set to 2), this would be rendered Epoch: 2 -context filter `license` +context function `license` ************************ The templates use `SPDX`_ license names and theses names are translated for different distros. For example, a project uses the `Apache-2.0` license:: - License: {{ 'Apache-2.0' | license }} + License: {{ license('Apache-2.0') }} With the `fedora` spec-style, this would be rendered to:: diff --git a/renderspec/__init__.py b/renderspec/__init__.py index 62eba1e..cb1e138 100644 --- a/renderspec/__init__.py +++ b/renderspec/__init__.py @@ -102,11 +102,6 @@ def _context_license_spdx(context, value): ############### # jinja2 filter ############### -@contextfilter -def _filter_license_spdx(context, value): - return _context_license_spdx(context, value) - - @contextfilter def _filter_epoch(context, value): return _context_epoch(context, value) @@ -137,7 +132,6 @@ def _globals_py2name(context, value): def _env_register_filters_and_globals(env): """register all the jinja2 filters we want in the environment""" - env.filters['license'] = _filter_license_spdx env.filters['epoch'] = _filter_epoch env.globals['py2pkg'] = _globals_py2pkg env.globals['py2name'] = _globals_py2name