|
@ -1,6 +1,7 @@ |
|
|
# -*- 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 json |
|
|
import logging |
|
|
import logging |
|
|
from odoo.http import JsonRequest, Root, Response |
|
|
from odoo.http import JsonRequest, Root, Response |
|
|
|
|
|
|
|
@ -8,12 +9,6 @@ from odoo.http import JsonRequest, Root, Response |
|
|
old_get_request = Root.get_request |
|
|
old_get_request = Root.get_request |
|
|
_logger = logging.getLogger(__name__) |
|
|
_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): |
|
|
if (httprequest.mimetype == "application/json" and |
|
|
if (httprequest.mimetype == "application/json" and |
|
@ -45,7 +40,7 @@ class RESTJsonRequest(JsonRequest): |
|
|
response['result'] = result |
|
|
response['result'] = result |
|
|
|
|
|
|
|
|
mime = 'application/json' |
|
|
mime = 'application/json' |
|
|
body = simplejson.dumps(response) |
|
|
|
|
|
|
|
|
body = json.dumps(response) |
|
|
|
|
|
|
|
|
return Response( |
|
|
return Response( |
|
|
body, headers=[('Content-Type', mime), |
|
|
body, headers=[('Content-Type', mime), |
|
|