Skip to content
Myr

Merge pull request #502 from berrange/callable

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

authored by David Lord · committed by GitHub · parents e276843, 91255f8 · Browse files · 1 file+8 added−7 removed
This commit

State

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

Trailers

  • runtime: avoid assumption that all objects provide __call__

Diff stats

1 file+8 added−7 removed

  • other:+8 added−7 removed

1 file+8 added−7 removed

modified:jinja2/runtime.py+8 added-7 removed
240 unmodified lines
241 if __debug__:242 __traceback_hide__ = True # noqa243244 # Allow callable classes to take a context245 if hasattr(__obj, '__call__'):245 fn = __obj.__call__246 for fn_type in ('contextfunction',247 'evalcontextfunction',248 'environmentfunction'):249 if hasattr(fn, fn_type):250 __obj = fn251 break246 fn = __obj.__call__247 for fn_type in ('contextfunction',248 'evalcontextfunction',249 'environmentfunction'):250 if hasattr(fn, fn_type):251 __obj = fn252 break253254 if isinstance(__obj, _context_function_types):255 if getattr(__obj, 'contextfunction', 0):256 args = (__self,) + args
557 unmodified lines