Browse Source
[IMP] use json library instead of simplejson
pull/372/head
Holger Brunn
6 years ago
No known key found for this signature in database
GPG Key ID: 1C9760FECA3AE18
3 changed files with
4 additions and
10 deletions
-
mail_sendgrid/__manifest__.py
-
mail_sendgrid/controllers/json_request.py
-
requirements.txt
|
|
@ -20,6 +20,6 @@ |
|
|
|
'installable': True, |
|
|
|
'auto_install': False, |
|
|
|
'external_dependencies': { |
|
|
|
'python': ['sendgrid', 'simplejson'], |
|
|
|
'python': ['sendgrid'], |
|
|
|
}, |
|
|
|
} |
|
|
@ -1,6 +1,7 @@ |
|
|
|
# -*- 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 json |
|
|
|
import logging |
|
|
|
from odoo.http import JsonRequest, Root, Response |
|
|
|
|
|
|
@ -8,12 +9,6 @@ from odoo.http import JsonRequest, Root, Response |
|
|
|
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): |
|
|
|
if (httprequest.mimetype == "application/json" and |
|
|
@ -45,7 +40,7 @@ class RESTJsonRequest(JsonRequest): |
|
|
|
response['result'] = result |
|
|
|
|
|
|
|
mime = 'application/json' |
|
|
|
body = simplejson.dumps(response) |
|
|
|
body = json.dumps(response) |
|
|
|
|
|
|
|
return Response( |
|
|
|
body, headers=[('Content-Type', mime), |
|
|
|
|
|
@ -1,3 +1,2 @@ |
|
|
|
premailer |
|
|
|
simplejson |
|
|
|
sendgrid |
|
|
|
sendgrid |