From 541ad118363641bee8cf0b58ac333138ba26c70c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20NO=C3=8BL?= <tnoel@entrouvert.com>
Date: Thu, 21 Apr 2022 10:27:52 +0200
Subject: [PATCH 3/3] misc: remove passerelle.compat dependency (#64409)

---
 passerelle_minint/minint_maarch/views.py | 12 ++++++------
 passerelle_minint/minint_seisin/views.py |  5 +++--
 tests/utils.py                           |  3 +--
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/passerelle_minint/minint_maarch/views.py b/passerelle_minint/minint_maarch/views.py
index c660e83..83ac8d3 100644
--- a/passerelle_minint/minint_maarch/views.py
+++ b/passerelle_minint/minint_maarch/views.py
@@ -16,6 +16,7 @@
 
 import base64
 from datetime import datetime
+import json
 import logging
 import re
 import requests
@@ -26,7 +27,6 @@ from django.utils.decorators import method_decorator
 from django.utils.encoding import force_text
 from django.views.decorators.csrf import csrf_exempt
 
-from passerelle.compat import json_loads
 import passerelle.utils as utils
 from passerelle.soap import sudsobject_to_dict, client_to_jsondict
 from suds import TypeNotFound
@@ -86,7 +86,7 @@ class ResourceView(DetailView):
     @utils.protected_api('can_access')
     def post(self, request, *args, **kwargs):
         client = self.get_client()
-        formdata = json_loads(request.body)
+        formdata = json.loads(request.body)
         extras = formdata.get('extra', {})
 
         debug = 'debug' in request.GET
@@ -116,7 +116,7 @@ class ResourceView(DetailView):
         # get translations
         translations_txt = extras.get('translations')
         if translations_txt:
-            self.translations = json_loads(translations_txt)
+            self.translations = json.loads(translations_txt)
             # logger.debug('Translation JSON: %r', translations)
 
         document = '<html>'
@@ -383,7 +383,7 @@ class AttachmentView(DetailView):
     @utils.protected_api('can_access')
     def post(self, request, *args, **kwargs):
         client = self.get_client()
-        formdata = json_loads(request.body)
+        formdata = json.loads(request.body)
         extras = formdata.get('extra', {})
 
         debug = 'debug' in request.GET
@@ -484,7 +484,7 @@ class DebugView(DetailView):
     @utils.protected_api('can_access')
     def post(self, request, *args, **kwargs):
         client = self.get_client()
-        formdata = json_loads(request.body)
+        formdata = json.loads(request.body)
         extras = formdata.get('extra', {})
         logger.debug('formdata %r: ', formdata)
         debug = False # 'debug' in request.GET
@@ -514,7 +514,7 @@ class DebugView(DetailView):
         translations_txt = extras.get('translations')
 
         if translations_txt:
-            self.translations = json_loads(translations_txt)
+            self.translations = json.loads(translations_txt)
             logger.debug('Translation JSON: %r', self.translations)
         else:
             logger.debug('AUCUNE Translation JSON: %r', self.translations)
diff --git a/passerelle_minint/minint_seisin/views.py b/passerelle_minint/minint_seisin/views.py
index ba299fa..083f3ea 100644
--- a/passerelle_minint/minint_seisin/views.py
+++ b/passerelle_minint/minint_seisin/views.py
@@ -14,11 +14,12 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+import json
+
 from django.views.generic import DetailView as GenericDetailView
 from django.utils.decorators import method_decorator
 from django.views.decorators.csrf import csrf_exempt
 
-from passerelle.compat import json_loads
 import passerelle.utils as utils
 from passerelle.soap import sudsobject_to_dict, client_to_jsondict
 
@@ -63,7 +64,7 @@ class ResourceView(DetailView):
     @utils.protected_api('can_access')
     def post(self, request, *args, **kwargs):
         client = self.get_client()
-        formdata = json_loads(request.body)
+        formdata = json.loads(request.body)
         fields = formdata.get('fields', {})
         extras = formdata.get('extra', {})
         workflow_fields = formdata.get('workflow', {}).get('fields', {})
diff --git a/tests/utils.py b/tests/utils.py
index d4ca9b9..465d9e6 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -8,7 +8,6 @@ from django.contrib.contenttypes.models import ContentType
 from django.urls import reverse
 
 from passerelle.base.models import ApiUser, AccessRight
-from passerelle.compat import json_loads
 
 
 def generic_endpoint_url(connector, endpoint, slug='test'):
@@ -29,7 +28,7 @@ class FakedResponse(mock.Mock):
     headers = {}
 
     def json(self):
-        return json_loads(self.content)
+        return json.loads(self.content)
 
 
 def mock_url(url=None, response='', status_code=200, headers=None):
-- 
2.35.1

