#NEWLINE# def save_virtual_workbook( workbook ) : #NEWLINE# #INDENT# 'Return an in-memory workbook, suitable for a Django response.' #NEWLINE# writer = ExcelWriter ( workbook ) #NEWLINE# temp_buffer = StringIO ( ) #NEWLINE# try : #NEWLINE# #INDENT# archive = ZipFile ( temp_buffer , 'w' , ZIP_DEFLATED ) #NEWLINE# writer . write_data ( archive ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# archive . close ( ) #NEWLINE# #UNINDENT# virtual_workbook = temp_buffer . getvalue ( ) #NEWLINE# temp_buffer . close ( ) #NEWLINE# return virtual_workbook