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

  1. # -*- encoding: utf-8 -*-
  2. ##############################################################################
  3. #
  4. # Copyright (C) 2016 Compassion CH (http://www.compassion.ch)
  5. # Releasing children from poverty in Jesus' name
  6. # @author: Emanuel Cino <ecino@compassion.ch>
  7. #
  8. # The licence is in the file __openerp__.py
  9. #
  10. ##############################################################################
  11. import logging
  12. from openerp import http
  13. from openerp.addons.mail_tracking.controllers.main import \
  14. MailTrackingController, _env_get
  15. _logger = logging.getLogger(__name__)
  16. class SendgridTrackingController(MailTrackingController):
  17. """
  18. Sendgrid is posting JSON so we must define a new route for tracking.
  19. """
  20. @http.route('/mail/tracking/sendgrid/<string:db>',
  21. type='json', auth='none', csrf=False)
  22. def mail_tracking_sendgrid(self, db, **kw):
  23. try:
  24. _env_get(db, self._tracking_event, None, None, **kw)
  25. return {'status': 200}
  26. except:
  27. return {'status': 400}