Skip to content
Myr

Smaller fixes to stuff that broke on 3.x

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent e8ef8aa · Browse files · 3 files+10 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+10 added−1 removed

  • tests:+1 added−1 removed
  • other:+9 added−0 removed

3 files+10 added−1 removed

modified:jinja2/asyncfilters.py+2 added
45 unmodified lines
4647 if wrap_evalctx:48 wrapper.evalcontextfilter = True4950 wrapper.asyncfiltervariant = True5152 return wrapper535455def asyncfiltervariant(original):
91 unmodified lines
modified:jinja2/nodes.py+7 added
590 unmodified lines
591 # python 3. because of that, do not rename filter_ to filter!592 filter_ = self.environment.filters.get(self.name)593 if filter_ is None or getattr(filter_, 'contextfilter', False):594 raise Impossible()595596 # We cannot constant handle async filters, so we need to make sure597 # to not go down this path.598 if eval_ctx.environment.is_async and \599 getattr(filter_, 'asyncfiltervariant', False):600 raise Impossible()601602 obj = self.node.as_const(eval_ctx)603 args = [obj] + [x.as_const(eval_ctx) for x in self.args]604 if getattr(filter_, 'evalcontextfilter', False):605 args.insert(0, eval_ctx)
318 unmodified lines
modified:tests/test_filters.py+1 added-1 removed
579 unmodified lines
580 def test_json_dump(self):581 env = Environment(autoescape=True)582 t = env.from_string('{{ x|tojson }}')583 assert t.render(x={'foo': 'bar'}) == '{"foo": "bar"}'584 assert t.render(x='"bar\'') == '"\"bar\u0027"'584 assert t.render(x='"bar\'') == r'"\"bar\u0027"'585586 def my_dumps(value, **options):587 assert options == {'foo': 'bar'}588 return '42'
3 unmodified lines