django.template.getargspec

Here are the examples of the python api django.template.getargspec taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

Example 1

Project: indextank-service Source File: custom_tags.py
def simple_var_tag(func):
    params, xx, xxx, defaults = template.getargspec(func)

    class SimpleNode(Node):
        def __init__(self, vars_to_resolve):
            self.vars_to_resolve = vars_to_resolve

        def render(self, context):
            resolved_vars = [var.resolve(context, True) for var in self.vars_to_resolve]
            return func(*resolved_vars)

    compile_func = template.curry(var_tag_compiler, params, defaults, getattr(func, "_decorated_function", func).__name__, SimpleNode)
    compile_func.__doc__ = func.__doc__
    register.tag(getattr(func, "_decorated_function", func).__name__, compile_func)
    return func