def print_export_invoices(self): d = Printer() date_from = request.params.get("from") date_to = request.params.get("to") doc = d.export_to_cdn(date_from, date_to) response.headers["Content-type"] = "text/xml; charset='utf-8'" response.headers["Content-disposition"] = "attachment; filename=%s" % "faktury.xml" content = doc.getvalue() response.headers["Content-Length"] = str(len(content)) doc.close() return content