Browse Source

Merge pull request #282 from yelizariev/13.0-simplejson

commit is created by 👷‍♂️ Merge Bot: https://odoo-devops.readthedocs.io/en/latest/git/github-merge-bot.html
pull/286/head
Mitchell Admin 5 years ago
committed by GitHub
parent
commit
a3721b9713
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .isort.cfg
  2. 9
      mailgun/models/ir_config_parameter.py

2
.isort.cfg

@ -9,4 +9,4 @@ line_length=88
known_odoo=odoo known_odoo=odoo
known_odoo_addons=odoo.addons known_odoo_addons=odoo.addons
sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER
known_third_party=requests,simplejson,werkzeug
known_third_party=requests,werkzeug

9
mailgun/models/ir_config_parameter.py

@ -1,10 +1,15 @@
import logging import logging
import requests import requests
import simplejson
from odoo import api, models from odoo import api, models
try:
import simplejson as json
except ImportError:
import json
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
@ -23,6 +28,6 @@ class IrConfigParameter(models.Model):
res = requests.put(url, auth=("api", api_key)) res = requests.put(url, auth=("api", api_key))
if ( if (
res.status_code == 200 res.status_code == 200
and simplejson.loads(res.text)["domain"]["state"] == "active"
and json.loads(res.text)["domain"]["state"] == "active"
): ):
self.sudo().set_param("mailgun.verified", "1") self.sudo().set_param("mailgun.verified", "1")
Loading…
Cancel
Save