@@ -0,0 +1,1876 @@
+from django import template%0A%0A%0Aregister = template.Library()%0A%0A%0Aclass CallNode(template.Node):%0A    def __init__(self, func, args, name, nodelist):%0A        self.func = func%0A        self.args = args%0A        self.name = name%0A        self.nodelist = nodelist%0A%0A    def __repr__(self):%0A        return %22%3CCallNode%3E%22%0A%0A    def _lookup_func(self, context):%0A        parts = self.func.split('.')%0A        current = context%5Bparts%5B0%5D%5D %0A        for part in parts%5B1:%5D:%0A            if part.startswith(%22_%22):%0A                raise ValueError(%0A                    %22Function cannot traverse private implementation attributes%22)%0A            current = getattr(current, part)%0A        return current%0A%0A    def render(self, context):%0A        try:%0A            func = self._lookup_func(context) %0A            values = %5Btemplate.Variable(arg).resolve(context) for arg in self.args%5D%0A            context.push()%0A            context%5Bself.name%5D = func(*values)%0A            output = self.nodelist.render(context)%0A            context.pop()%0A            return output%0A        except Exception as ex:%0A            import logging%0A            logging.exception(%22Unable to call %25s with %25r: %25s%22,%0A                              self.func, self.args, ex)%0A            raise%0A%0Adef do_call(parser, token):%0A    %22%22%22%0A    Adds a value to the context (inside of this block) for caching and easy%0A    access.%0A%0A    For example::%0A%0A        %7B%25 call func 1 2 3 as result %25%7D%0A            %7B%7B result %7D%7D%0A        %7B%25 endcall %25%7D%0A    %22%22%22%0A    bits = list(token.split_contents())%0A    if len(bits) %3C 2 or bits%5B-2%5D != %22as%22:%0A        raise TemplateSyntaxError(%0A            %22%25r expected format is 'call func %5Bargs%5D %5Bas name%5D'%22 %25 bits%5B0%5D)%0A    func = bits%5B1%5D%0A    args = bits%5B2:-2%5D%0A    name = bits%5B-1%5D%0A    nodelist = parser.parse(('endcall',))%0A    parser.delete_first_token()%0A    return CallNode(func, args, name, nodelist)%0A%0Ado_call = register.tag('call', do_call)%0A

Add {% call %} template tag.