Skip to content
Myr

Merge pull request #1108 from captainmalloc/runtime_calls

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

Use 'callable' instead of typechecking for runtime calls ctx/env injection

authored by David Lord · committed by GitHub · parents 540b260, 70ea1d3 · Browse files · 3 files+4 added−6 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+4 added−6 removed

  • other:+4 added−6 removed

3 files+4 added−6 removed

modified:jinja2/nodes.py-4 removed
18 unmodified lines
19from jinja2.utils import Markup20from jinja2._compat import izip, with_metaclass, text_type, PY2212223#: the types we support for context functions24_context_function_types = (types.FunctionType, types.MethodType)252623_binop_to_func = {24 '*': operator.mul,25 '/': operator.truediv,26 '//': operator.floordiv,
974 unmodified lines
modified:jinja2/runtime.py+2 added-2 removed
11 unmodified lines
1213from itertools import chain14from types import MethodType1516from jinja2.nodes import EvalContext, _context_function_types16from jinja2.nodes import EvalContext17from jinja2.utils import Markup, soft_unicode, escape, missing, concat, \18 internalcode, object_type_repr, evalcontextfunction, Namespace19from jinja2.exceptions import UndefinedError, TemplateRuntimeError, \20 TemplateNotFound
229 unmodified lines
250 if hasattr(fn, fn_type):251 __obj = fn252 break253254 if isinstance(__obj, _context_function_types):254 if callable(__obj):255 if getattr(__obj, 'contextfunction', 0):256 args = (__self,) + args257 elif getattr(__obj, 'evalcontextfunction', 0):258 args = (__self.eval_ctx,) + args
641 unmodified lines
modified:CHANGES.rst+2 added
73 unmodified lines
74 to be wrapped individually, rather than creating short intermediate75 lines. :issue:`175`76- Add ``break_on_hyphens`` parameter to ``|wordwrap`` filter.77 :issue:`550`78- Use :func:`callable` to inject context at runtime for compatibility79 with Cython compiled functions. :pr:`1108`808182Version 2.10.383--------------
629 unmodified lines