Skip to content
Myr

- Allow callable classes to have contextfunction and the like

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

authored by Richard Eames · committed by Richard Eames · parent ea2890d · Browse files · 1 file+11 added−0 removed
This commit

State

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

Diff stats

1 file+11 added−0 removed

  • other:+11 added−0 removed

1 file+11 added−0 removed

modified:jinja2/runtime.py+11 added
169 unmodified lines
170 :func:`environmentfunction`.171 """172 if __debug__:173 __traceback_hide__ = True174 175 # Allow callable classes to take a context176 if hasattr(__obj, '__call__'):177 fn = __obj.__call__178 for fn_type in ('contextfunction', 179 'evalcontextfunction', 180 'environmentfunction'):181 if hasattr(fn, fn_type):182 __obj = fn183 break;184 185 if isinstance(__obj, _context_function_types):186 if getattr(__obj, 'contextfunction', 0):187 args = (__self,) + args188 elif getattr(__obj, 'evalcontextfunction', 0):
384 unmodified lines