#NEWLINE# @ any_permission_required ( [ ( 'Admin' , '%' ) , ( 'AdminTools' , 'View' ) , ( 'ReviewerAdminTools' , 'View' ) , ( 'BulkValidationAdminTools' , 'View' ) ] ) #NEWLINE# def validation_tally_csv( request , job_id ) : #NEWLINE# #INDENT# resp = http . HttpResponse ( ) #NEWLINE# resp [ 'Content-Type' ] = 'text/csv; charset=utf-8' #NEWLINE# resp [ 'Content-Disposition' ] = ( 'attachment; filename=validation_tally_%s.csv' % job_id ) #NEWLINE# writer = csv . writer ( resp ) #NEWLINE# fields = [ 'message_id' , 'message' , 'long_message' , 'type' , 'addons_affected' ] #NEWLINE# writer . writerow ( fields ) #NEWLINE# job = ValidationJobTally ( job_id ) #NEWLINE# keys = [ 'key' , 'message' , 'long_message' , 'type' , 'addons_affected' ] #NEWLINE# for msg in job . get_messages ( ) : #NEWLINE# #INDENT# writer . writerow ( [ smart_str ( msg [ k ] , encoding = 'utf8' , strings_only = True ) for k in keys ] ) #NEWLINE# #UNINDENT# return resp