def attachments_download(req, path, webid): attachment = Attachment(Attachment.web_to_id(webid)) attachment.get(req) req.headers_out.add_header( 'Content-Disposition', 'attachment', # filename=attachment.file_name.encode('ascii','xmlcharrefreplace')) filename=attachment.file_name.encode('ascii', 'backslashreplace')) return send_file(req, req.cfg.attachments_path + '/' + path + '/' + webid, content_type=attachment.mime_type)
def attachments_normal(req, path, webid): attachment = Attachment(Attachment.web_to_id(webid)) attachment.get(req) return send_file(req, req.cfg.attachments_path + '/' + path + '/' + webid, content_type=attachment.mime_type)