You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.0 KiB
31 lines
1.0 KiB
# -*- encoding: utf-8 -*-
|
|
##############################################################################
|
|
#
|
|
# Copyright (C) 2016 Compassion CH (http://www.compassion.ch)
|
|
# Releasing children from poverty in Jesus' name
|
|
# @author: Emanuel Cino <ecino@compassion.ch>
|
|
#
|
|
# The licence is in the file __openerp__.py
|
|
#
|
|
##############################################################################
|
|
import logging
|
|
|
|
from openerp import http
|
|
from openerp.addons.mail_tracking.controllers.main import \
|
|
MailTrackingController, _env_get
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
class SendgridTrackingController(MailTrackingController):
|
|
"""
|
|
Sendgrid is posting JSON so we must define a new route for tracking.
|
|
"""
|
|
@http.route('/mail/tracking/sendgrid/<string:db>',
|
|
type='json', auth='none', csrf=False)
|
|
def mail_tracking_sendgrid(self, db, **kw):
|
|
try:
|
|
_env_get(db, self._tracking_event, None, None, **kw)
|
|
return {'status': 200}
|
|
except:
|
|
return {'status': 400}
|