Browse Source

Rewrite dependencies of sendgrid module fixes #261

pull/262/head
Emanuel Cino 7 years ago
parent
commit
fa5ef8aa6f
  1. 1
      .travis.yml
  2. 6
      mail_sendgrid/__manifest__.py
  3. 10
      mail_sendgrid/controllers/json_request.py
  4. 2
      requirements.txt

1
.travis.yml

@ -28,7 +28,6 @@ virtualenv:
system_site_packages: true system_site_packages: true
install: install:
- pip install sendgrid
- git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools - git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH} - export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- travis_install_nightly - travis_install_nightly

6
mail_sendgrid/__manifest__.py

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2015-2017 Compassion CH (http://www.compassion.ch)
# Copyright 2015-2018 Compassion CH (http://www.compassion.ch)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
'name': 'SendGrid', 'name': 'SendGrid',
'version': '10.0.1.0.0',
'version': '10.0.1.0.1',
'category': 'Social Network', 'category': 'Social Network',
'author': 'Compassion CH, Odoo Community Association (OCA)', 'author': 'Compassion CH, Odoo Community Association (OCA)',
'license': 'AGPL-3', 'license': 'AGPL-3',
@ -20,6 +20,6 @@
'installable': True, 'installable': True,
'auto_install': False, 'auto_install': False,
'external_dependencies': { 'external_dependencies': {
'python': ['sendgrid'],
'python': ['sendgrid', 'simplejson'],
}, },
} }

10
mail_sendgrid/controllers/json_request.py

@ -1,12 +1,18 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2016-2017 Compassion CH (http://www.compassion.ch) # Copyright 2016-2017 Compassion CH (http://www.compassion.ch)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import simplejson
import logging
from odoo.http import JsonRequest, Root, Response from odoo.http import JsonRequest, Root, Response
# Monkeypatch type of request rooter to use RESTJsonRequest # Monkeypatch type of request rooter to use RESTJsonRequest
old_get_request = Root.get_request old_get_request = Root.get_request
_logger = logging.getLogger(__name__)
try:
import simplejson
except ImportError:
_logger.error("Please install simplejson tu use mail_sendgrid module")
_logger.debug("ImportError details:", exc_info=True)
def get_request(self, httprequest): def get_request(self, httprequest):

2
requirements.txt

@ -1 +1,3 @@
premailer premailer
simplejson
sendgrid
Loading…
Cancel
Save