From fa5ef8aa6f8a19e2935f6f98bca076e96968e53b Mon Sep 17 00:00:00 2001 From: Emanuel Cino Date: Thu, 19 Apr 2018 13:24:01 +0200 Subject: [PATCH] Rewrite dependencies of sendgrid module fixes #261 --- .travis.yml | 1 - mail_sendgrid/__manifest__.py | 6 +++--- mail_sendgrid/controllers/json_request.py | 10 ++++++++-- requirements.txt | 4 +++- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index f4ace9c1..c8f9fedb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,6 @@ virtualenv: system_site_packages: true install: - - pip install sendgrid - git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools - export PATH=${HOME}/maintainer-quality-tools/travis:${PATH} - travis_install_nightly diff --git a/mail_sendgrid/__manifest__.py b/mail_sendgrid/__manifest__.py index f916e21b..f2c07e09 100644 --- a/mail_sendgrid/__manifest__.py +++ b/mail_sendgrid/__manifest__.py @@ -1,9 +1,9 @@ # -*- 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). { 'name': 'SendGrid', - 'version': '10.0.1.0.0', + 'version': '10.0.1.0.1', 'category': 'Social Network', 'author': 'Compassion CH, Odoo Community Association (OCA)', 'license': 'AGPL-3', @@ -20,6 +20,6 @@ 'installable': True, 'auto_install': False, 'external_dependencies': { - 'python': ['sendgrid'], + 'python': ['sendgrid', 'simplejson'], }, } diff --git a/mail_sendgrid/controllers/json_request.py b/mail_sendgrid/controllers/json_request.py index 189159ba..e2cd25bc 100644 --- a/mail_sendgrid/controllers/json_request.py +++ b/mail_sendgrid/controllers/json_request.py @@ -1,12 +1,18 @@ # -*- coding: utf-8 -*- # Copyright 2016-2017 Compassion CH (http://www.compassion.ch) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -import simplejson - +import logging from odoo.http import JsonRequest, Root, Response # Monkeypatch type of request rooter to use RESTJsonRequest 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): diff --git a/requirements.txt b/requirements.txt index 8c94d1e2..ba72244b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,3 @@ -premailer \ No newline at end of file +premailer +simplejson +sendgrid \ No newline at end of file