def _validate_nodes_json(json_nodes, errors, user, workflow):
 assert isinstance(errors, dict), 'errors must be a dict.'
 result = True
 for node in json_nodes:
  _errors = {}
  node_dict = format_dict_field_values(node)
  if (node['node_type'] in ACTION_TYPES):
   node_result = _validate_node_json(node['node_type'], node_dict, _errors, user, workflow)
  else:
   node_result = True
  link_result = _validate_node_links_json(node['node_type'], node_dict['child_links'], _errors)
  result = (result and node_result and link_result)
  if ((not node.has_key('name')) and ((not node.has_key('node_type')) or (not node.has_key('id')))):
   raise StructuredException(code='INVALID_REQUEST_ERROR', message=_('Error saving workflow'), data={'errors': 'Node is missing a name.'}, error_code=400)
  errors[node.get('name', ('%s-%s' % (node.get('node_type'), node.get('id'))))] = _errors
 return result

def _validate_nodes_json ( json_nodes , errors , user , workflow ) : assert isinstance ( errors , dict ) , 'errors must be a dict.' result = True for node in json_nodes : _errors = { } node_dict = format_dict_field_values ( node ) if ( node [ 'node_type' ] in ACTION_TYPES ) : node_result = _validate_node_json ( node [ 'node_type' ] , node_dict , _errors , user , workflow ) else : node_result = True link_result = _validate_node_links_json ( node [ 'node_type' ] , node_dict [ 'child_links' ] , _errors ) result = ( result and node_result and link_result ) if ( ( not node . has_key ( 'name' ) ) and ( ( not node . has_key ( 'node_type' ) ) or ( not node . has_key ( 'id' ) ) ) ) : raise StructuredException ( code = 'INVALID_REQUEST_ERROR' , message = _ ( 'Error saving workflow' ) , data = { 'errors' : 'Node is missing a name.' } , error_code = 400 ) errors [ node . get ( 'name' , ( '%s-%s' % ( node . get ( 'node_type' ) , node . get ( 'id' ) ) ) ) ] = _errors return result
validates every node and link in the workflow .