@register.tag(name=u'form_field')
def do_form_field(parser, token):
 parts = token.contents.split(u' ', 2)
 if (len(parts) < 2):
  raise template.TemplateSyntaxError((u'%r tag must have the form field name as the first value, followed by optional key="value" attributes.' % parts[0]))
 html_attrs = {}
 if (len(parts) == 3):
  raw_args = list(args_split(parts[2]))
  if ((len(raw_args) % 2) != 0):
   raise template.TemplateSyntaxError((u'%r tag received the incorrect number of key=value arguments.' % parts[0]))
  for x in range(0, len(raw_args), 2):
   html_attrs[str(raw_args[x])] = Variable(raw_args[(x + 1)])
 return FormFieldNode(parts[1], html_attrs)

@ register . tag ( name = u'form_field' ) def do_form_field ( parser , token ) : parts = token . contents . split ( u' ' , 2 ) if ( len ( parts ) < 2 ) : raise template . TemplateSyntaxError ( ( u'%r tag must have the form field name as the first value, followed by optional key="value" attributes.' % parts [ 0 ] ) ) html_attrs = { } if ( len ( parts ) == 3 ) : raw_args = list ( args_split ( parts [ 2 ] ) ) if ( ( len ( raw_args ) % 2 ) != 0 ) : raise template . TemplateSyntaxError ( ( u'%r tag received the incorrect number of key=value arguments.' % parts [ 0 ] ) ) for x in range ( 0 , len ( raw_args ) , 2 ) : html_attrs [ str ( raw_args [ x ] ) ] = Variable ( raw_args [ ( x + 1 ) ] ) return FormFieldNode ( parts [ 1 ] , html_attrs )
render a wtforms form field allowing optional html attributes .