From 3c1ec8c15047bbcf9b0a252526279373eed4bda2 Mon Sep 17 00:00:00 2001 From: sgelis <74539800+sgelis@users.noreply.github.com> Date: Wed, 14 Dec 2022 17:25:52 +0100 Subject: [PATCH] Switch from jinja2.contextfunction (deprecated) to jinja2.pass_context --- patacrep/content/__init__.py | 2 +- patacrep/songs/chordpro/__init__.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/patacrep/content/__init__.py b/patacrep/content/__init__.py index d5fddd10..0bfe7ec5 100755 --- a/patacrep/content/__init__.py +++ b/patacrep/content/__init__.py @@ -202,7 +202,7 @@ class EmptyContentList(ContentList): for error in errors: self.append_error(error) -@jinja2.contextfunction +@jinja2.pass_context def render(context, content): """Render the content of the songbook as a LaTeX code. diff --git a/patacrep/songs/chordpro/__init__.py b/patacrep/songs/chordpro/__init__.py index 4367d3ef..7ff78fa2 100644 --- a/patacrep/songs/chordpro/__init__.py +++ b/patacrep/songs/chordpro/__init__.py @@ -6,7 +6,7 @@ import os import urllib from jinja2 import Environment, FileSystemLoader, ChoiceLoader -from jinja2 import contextfunction +from jinja2 import pass_context import jinja2 from patacrep import encoding, files, pkg_datapath @@ -88,7 +88,7 @@ class ChordproSong(Song): raise NotImplementedError("Cannot convert to format '{}'.".format(self.output_language)) @staticmethod - @contextfunction + @pass_context def _render_ast(context, content): """Render ``content``.""" # context is readonly: create a copy before overriding the 'content' key