(unused_parser, token)
return TemplateNode('%s.tmpl' % template, bindings)
Interpret a template with an additional set of variable bindings.

  Evaluates the template named 'template_name.tmpl' with the variables 'name1',
  'name2', etc., bound to the values of the variables 'val1', 'val2'.

  Usage -- either:
    {% call_template template_name name1=val1 name2=val2 %}
  or (for backwards compatibility):
    {% call_template template_name name1 val1 name2 val2 %}

  Mixing the two styles is not allowed.

  Args:
    unused_parser: (parser) the Django parser context.
    token: (django.template.Token) the token holding this tag

  Returns:
    a TemplateNode
Interpret a template with an additional set of variable bindings.
Interpret a template with an additional set of variable bindings .
def CallTemplate(unused_parser, token):
  """Interpret a template with an additional set of variable bindings.

  Evaluates the template named 'template_name.tmpl' with the variables 'name1',
  'name2', etc., bound to the values of the variables 'val1', 'val2'.

  Usage -- either:
    {% call_template template_name name1=val1 name2=val2 %}
  or (for backwards compatibility):
    {% call_template template_name name1 val1 name2 val2 %}

  Mixing the two styles is not allowed.

  Args:
    unused_parser: (parser) the Django parser context.
    token: (django.template.Token) the token holding this tag

  Returns:
    a TemplateNode
  """
  contents = token.split_contents()
  if len(contents) < 2:
    raise django_template.TemplateSyntaxError(
        'tag requires at least 1 argument, the called template')
  unused_tag, template = contents[:2]
  template_path = '%s.tmpl' % template
  toks = contents[2:]
  if not toks:
    return TemplateNode(template_path, {})

  has_equals = set('=' in t for t in toks)
  # Either all arguments should contain a '=', or none should.
  if len(has_equals) != 1:
    raise django_template.TemplateSyntaxError(
        'use either name1=value1 name2=value2 syntax, '
        'or name1 value1 name2 value2 syntax, but not both')
  has_equals = has_equals.pop()
  if has_equals:
    # If the actual key/value pairs are malformed, let it explode later
    bindings = dict(tok.split('=', 1) for tok in toks)
  else:
    if len(toks) % 2 != 0:
      raise django_template.TemplateSyntaxError(
          'odd number of keys and values found')
    bindings = dict(zip(toks[0::2], toks[1::2]))

  return TemplateNode('%s.tmpl' % template, bindings)
def CallTemplate ( unused_parser , token ) : contents = token . split_contents ( ) if len ( contents ) < 2 : raise django_template . TemplateSyntaxError ( 'tag requires at least 1 argument, the called template' ) unused_tag , template = contents [ : 2 ] template_path = '%s.tmpl' % template toks = contents [ 2 : ] if not toks : return TemplateNode ( template_path , { } ) has_equals = set ( '=' in t for t in toks ) # Either all arguments should contain a '=', or none should. if len ( has_equals ) != 1 : raise django_template . TemplateSyntaxError ( 'use either name1=value1 name2=value2 syntax, ' 'or name1 value1 name2 value2 syntax, but not both' ) has_equals = has_equals . pop ( ) if has_equals : # If the actual key/value pairs are malformed, let it explode later bindings = dict ( tok . split ( '=' , 1 ) for tok in toks ) else : if len ( toks ) % 2 != 0 : raise django_template . TemplateSyntaxError ( 'odd number of keys and values found' ) bindings = dict ( zip ( toks [ 0 : : 2 ] , toks [ 1 : : 2 ] ) ) return TemplateNode ( '%s.tmpl' % template , bindings )