From: Armin Ronacher Date: Sat, 18 May 2013 10:58:12 +0000 (+0100) Subject: Cleanup and changelog entry for new contextfunction behavior X-Git-Tag: 2.7~71^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9962c10b258472d7e07ec4d447d21fcee9d998c2;p=thirdparty%2Fjinja.git Cleanup and changelog entry for new contextfunction behavior --- diff --git a/CHANGES b/CHANGES index 6539c5fd..c2cd4a43 100644 --- a/CHANGES +++ b/CHANGES @@ -15,6 +15,7 @@ Version 2.7 want to change this encoding they can override the filter. - Accessing `last` on the loop context no longer causes the iterator to be consumed into a list. +- Allow `contextfunction` and other decorators to be applied to `__call__`. Version 2.6 ----------- diff --git a/jinja2/runtime.py b/jinja2/runtime.py index dd49426c..34259d80 100644 --- a/jinja2/runtime.py +++ b/jinja2/runtime.py @@ -171,17 +171,17 @@ class Context(object): """ if __debug__: __traceback_hide__ = True - + # Allow callable classes to take a context if hasattr(__obj, '__call__'): fn = __obj.__call__ - for fn_type in ('contextfunction', - 'evalcontextfunction', + for fn_type in ('contextfunction', + 'evalcontextfunction', 'environmentfunction'): if hasattr(fn, fn_type): __obj = fn - break; - + break + if isinstance(__obj, _context_function_types): if getattr(__obj, 'contextfunction', 0): args = (__self,) + args