From 3751379f1e9a4c215fb6eb898b4ccc67659b9ace Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 May 2022 21:51:50 +0700 Subject: initial commit 2 --- addons/event/controllers/main.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 addons/event/controllers/main.py (limited to 'addons/event/controllers/main.py') diff --git a/addons/event/controllers/main.py b/addons/event/controllers/main.py new file mode 100644 index 00000000..509d486b --- /dev/null +++ b/addons/event/controllers/main.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from werkzeug.exceptions import NotFound + +from odoo.http import Controller, request, route, content_disposition + + +class EventController(Controller): + + @route(['''/event//ics'''], type='http', auth="public") + def event_ics_file(self, event, **kwargs): + files = event._get_ics_file() + if not event.id in files: + return NotFound() + content = files[event.id] + return request.make_response(content, [ + ('Content-Type', 'application/octet-stream'), + ('Content-Length', len(content)), + ('Content-Disposition', content_disposition('%s.ics' % event.name)) + ]) -- cgit v1.2.3