def get_response_body(data_format, data_dict, error_list):
 if (data_format == 'application/json'):
  data_dict['Errors'] = error_list
  return json.dumps(data_dict)
 if (data_format and data_format.endswith('/xml')):
  output = '<delete>\n'
  for key in sorted(data_dict):
   xml_key = key.replace(' ', '_').lower()
   output += ('<%s>%s</%s>\n' % (xml_key, data_dict[key], xml_key))
  output += '<errors>\n'
  output += '\n'.join([('<object><name>%s</name><status>%s</status></object>' % (saxutils.escape(name), status)) for (name, status) in error_list])
  output += '</errors>\n</delete>\n'
  return output
 output = ''
 for key in sorted(data_dict):
  output += ('%s: %s\n' % (key, data_dict[key]))
 output += 'Errors:\n'
 output += '\n'.join([('%s, %s' % (name, status)) for (name, status) in error_list])
 return output

def get_response_body ( data_format , data_dict , error_list ) : if ( data_format == 'application/json' ) : data_dict [ 'Errors' ] = error_list return json . dumps ( data_dict ) if ( data_format and data_format . endswith ( '/xml' ) ) : output = '<delete>\n' for key in sorted ( data_dict ) : xml_key = key . replace ( ' ' , '_' ) . lower ( ) output += ( '<%s>%s</%s>\n' % ( xml_key , data_dict [ key ] , xml_key ) ) output += '<errors>\n' output += '\n' . join ( [ ( '<object><name>%s</name><status>%s</status></object>' % ( saxutils . escape ( name ) , status ) ) for ( name , status ) in error_list ] ) output += '</errors>\n</delete>\n' return output output = '' for key in sorted ( data_dict ) : output += ( '%s: %s\n' % ( key , data_dict [ key ] ) ) output += 'Errors:\n' output += '\n' . join ( [ ( '%s, %s' % ( name , status ) ) for ( name , status ) in error_list ] ) return output
returns a properly formatted response body according to format .