def write_course_block_detail_report(course_data):
 with open('xblock_course_detail.csv', 'wb') as csvfile:
  detail_writer = csv.writer(csvfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_ALL)
  detail_writer.writerow(['XBLOCK_TYPE_NAME', 'COURSE_NAME', 'COURSE_ID', 'COURSE_START', 'COURSE_END', 'NUM_XBLOCK_INSTANCES'])
  for course in course_data:
   for (block_type, count) in course.get(BLOCK_COUNTS_KEY, []).items():
    if (count > 0):
     detail_writer.writerow([block_type, course.get(COURSE_NAME_KEY, '').encode('utf-8'), course.get(COURSE_ID_KEY, ''), course.get(COURSE_START_KEY, ''), course.get(COURSE_END_KEY, ''), str(count)])
  csvfile.close()

def write_course_block_detail_report ( course_data ) : with open ( 'xblock_course_detail.csv' , 'wb' ) as csvfile : detail_writer = csv . writer ( csvfile , delimiter = ',' , quotechar = '"' , quoting = csv . QUOTE_ALL ) detail_writer . writerow ( [ 'XBLOCK_TYPE_NAME' , 'COURSE_NAME' , 'COURSE_ID' , 'COURSE_START' , 'COURSE_END' , 'NUM_XBLOCK_INSTANCES' ] ) for course in course_data : for ( block_type , count ) in course . get ( BLOCK_COUNTS_KEY , [ ] ) . items ( ) : if ( count > 0 ) : detail_writer . writerow ( [ block_type , course . get ( COURSE_NAME_KEY , '' ) . encode ( 'utf-8' ) , course . get ( COURSE_ID_KEY , '' ) , course . get ( COURSE_START_KEY , '' ) , course . get ( COURSE_END_KEY , '' ) , str ( count ) ] ) csvfile . close ( )
generate a csv file containing the detailed information about the xblocks available per course arguments: course_data : a list of course_data objects returns: nothing .