Browse Source
🛡️ treat simplejson as external package that may not be installed
pull/278/head
Ivan Yelizariev
5 years ago
No known key found for this signature in database
GPG Key ID: B87954F73B65AC8A
2 changed files with
7 additions and
3 deletions
-
.isort.cfg
-
mailgun/models.py
|
@ -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=openerp,requests,simplejson |
|
|
|
|
|
|
|
|
known_third_party=openerp,requests |
|
@ -2,9 +2,13 @@ |
|
|
import logging |
|
|
import logging |
|
|
|
|
|
|
|
|
import requests |
|
|
import requests |
|
|
import simplejson |
|
|
|
|
|
from openerp import api, models |
|
|
from openerp import api, models |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
|
|
import simplejson as json |
|
|
|
|
|
except ImportError: |
|
|
|
|
|
import json |
|
|
|
|
|
|
|
|
_logger = logging.getLogger(__name__) |
|
|
_logger = logging.getLogger(__name__) |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -38,6 +42,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.set_param("mailgun.verified", "1") |
|
|
self.set_param("mailgun.verified", "1") |