| 861 | def simple_tag_with_context(self,func): |
| 862 | (params, xx, xxx, defaults) = getargspec(func) |
| 863 | |
| 864 | class SimpleWithContextNode(Node): |
| 865 | def __init__(self, vars_to_resolve): |
| 866 | self.vars_to_resolve = vars_to_resolve |
| 867 | |
| 868 | def render(self, context): |
| 869 | resolved_vars = [resolve_variable(var, context) for var in self.vars_to_resolve] |
| 870 | rendered = func(context, *resolved_vars) |
| 871 | return rendered or '' |
| 872 | |
| 873 | compile_func = curry(generic_tag_compiler, params[1:], defaults, func.__name__, SimpleWithContextNode) |
| 874 | compile_func.__doc__ = func.__doc__ |
| 875 | self.tag(func.__name__, compile_func) |
| 876 | return func |
| 877 | |