From e3d265eb1433043d1f1b442580ce54a11e8fc750 Mon Sep 17 00:00:00 2001 From: Thomas NOEL Date: Fri, 29 May 2020 17:50:13 +0200 Subject: [PATCH] maarch: use compat.json_loads (#43464) --- passerelle_minint/minint_maarch/views.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/passerelle_minint/minint_maarch/views.py b/passerelle_minint/minint_maarch/views.py index 27fde0a..00e0a57 100644 --- a/passerelle_minint/minint_maarch/views.py +++ b/passerelle_minint/minint_maarch/views.py @@ -115,7 +115,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 = u'' @@ -382,7 +382,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 @@ -435,6 +435,7 @@ class AttachmentView(DetailView): # parameter. Get value from formdata or workflow options. maarch_id = extras.get('maarch_id') notification_email = extras.get('notification_email') if maarch_id else None + notification_model = extras.get('notification_model') if maarch_id else None if debug: debug_output['maarch_id'] = maarch_id @@ -454,11 +455,12 @@ class AttachmentView(DetailView): countAttachment += 1 if maarch_id: email_to = notification_email if notification_email and countAttachment == nbAttachments else '' + modele_ae = notification_model if notification_model and countAttachment == nbAttachments else '' logger.debug('storeAdditionalAttachmentResource: INES maarch_id: %r', maarch_id) client.service.storeAdditionalAttachmentResource( maarch_id, resId, collId, attachment['content'], - attachment['fileFormat'], attachment['filename'], email_to) + attachment['fileFormat'], attachment['filename'], email_to, modele_ae) else: results = client.service.storeAttachmentResource( resId, collId, attachment['content'], @@ -481,7 +483,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 @@ -511,8 +513,7 @@ class DebugView(DetailView): translations_txt = extras.get('translations') if translations_txt: - # config = json.loads(open('config/defaults.json').read()) - 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)