misc: remove passerelle.compat dependency (#64409)
This commit is contained in:
parent
0b4ea4eb0b
commit
541ad11836
|
@ -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)
|
||||
|
|
|
@ -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', {})
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue