Skip to content

Commit

Permalink
Cleanup and changelog entry for new contextfunction behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed May 18, 2013
1 parent 9952041 commit 9962c10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -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
-----------
Expand Down
10 changes: 5 additions & 5 deletions jinja2/runtime.py
Expand Up @@ -171,17 +171,17 @@ def call(__self, __obj, *args, **kwargs):
"""
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
Expand Down

0 comments on commit 9962c10

Please sign in to comment.