#NEWLINE# @ ensure_template_arg #NEWLINE# def get_variables_from_template( template ) : #NEWLINE# #INDENT# variable_nodes = [ n for n in template . nodelist if isinstance ( n , DefineNode ) ] #NEWLINE# variables = SortedDict ( ) #NEWLINE# for node in variable_nodes : #NEWLINE# #INDENT# if ( node . variable_name in variables ) : #NEWLINE# #INDENT# raise TemplateSyntaxError ( ( '%s defined multiple times - %s' % ( node . variable_name , _get_template_name_from_node ( node ) ) ) ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# variables [ node . variable_name ] = { #NEWLINE# #INDENT# 'type' : get_type ( node . variable_type ) , #NEWLINE# 'optional' : node . optional , #NEWLINE# 'initial_field_values' : node . initial_field_values , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# raise TemplateSyntaxError ( ( '%s type not registered - %s' % ( node . variable_type , _get_template_name_from_node ( node ) ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# return variables