def print_sell_registry(self): d = Printer() doc = d.sell_registry() response.headers["Content-type"] = "application/vnd.ms-excel" response.headers["Content-disposition"] = "attachment; filename=%s" % "rejestr_sprzedazy.xls" content = doc.getvalue() response.headers["Content-Length"] = str(len(content)) doc.close() return content