@register.tag('with')
def do_with(parser, token):
 bits = token.split_contents()
 remaining_bits = bits[1:]
 extra_context = token_kwargs(remaining_bits, parser, support_legacy=True)
 if (not extra_context):
  raise TemplateSyntaxError(('%r expected at least one variable assignment' % bits[0]))
 if remaining_bits:
  raise TemplateSyntaxError(('%r received an invalid token: %r' % (bits[0], remaining_bits[0])))
 nodelist = parser.parse(('endwith',))
 parser.delete_first_token()
 return WithNode(None, None, nodelist, extra_context=extra_context)

@ register . tag ( 'with' ) def do_with ( parser , token ) : bits = token . split_contents ( ) remaining_bits = bits [ 1 : ] extra_context = token_kwargs ( remaining_bits , parser , support_legacy = True ) if ( not extra_context ) : raise TemplateSyntaxError ( ( '%r expected at least one variable assignment' % bits [ 0 ] ) ) if remaining_bits : raise TemplateSyntaxError ( ( '%r received an invalid token: %r' % ( bits [ 0 ] , remaining_bits [ 0 ] ) ) ) nodelist = parser . parse ( ( 'endwith' , ) ) parser . delete_first_token ( ) return WithNode ( None , None , nodelist , extra_context = extra_context )
adds one or more values to the context for caching and easy access .