def to_csv(self, fileobj):
     """generate CSV in fileobj"""
     csvwriter = csv.writer(fileobj, dialect='excel', delimiter='\t')
     fixer = lambda row: [unicode(x).encode('utf-8') for x in row]
     self.create_header(csvwriter, fixer)
     for row in query_iterator(self.query):
         self.create_row(csvwriter, row, fixer)
 def to_xls(self, fileobj):
     """generate XLS in fileobj"""
     import huTools.structured_xls
     xlswriter = huTools.structured_xls.XLSwriter()
     self.create_header(xlswriter)
     for row in query_iterator(self.query):
         self.create_row(xlswriter, row)
     xlswriter.save(fileobj)