def parsingTag(node, name, required=0): r""" Decorator to replace the standard tag mini-parser. Will pass all the parameters to the node, in the order given, after filtering out "for" and "as". Sample tag: @parsingTag("a_tag") class ANode(template.Node): def __init__(self, someval, retval): self.someval=someval self.retval=retval def render(self, context): context[self.retval]=self.someval print self.someval return '' Sample template usage: {% a_tag for "example" as retval %} """ #@ register.tag(name=name) def do_parsing(parser, token): args=token.split_contents() args=filter(lambda x: x not in ['for', 'as'], args) if required