Projet

Général

Profil

Bug #25784

on ne devrait pas être obligé de mettre un varname lors d'un appel webservice "document"

Ajouté par Thomas Noël il y a plus de 5 ans. Mis à jour il y a plus de 5 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Version cible:
-
Début:
23 août 2018
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:

Description

Quand on a des champs backoffice fichier, sur un appel webservice qui renvoie un document, on peut indiquer le champ backoffice qui doit recevoir le fichier.

Mais bogue : ça ne marche que si on indique un varname, alors que ça devrait pas.


Fichiers

Révisions associées

Révision f5857ca7 (diff)
Ajouté par Thomas Noël il y a plus de 5 ans

wscall: allow storing in backoffice file without varname (#25784)

Historique

#1

Mis à jour par Thomas Noël il y a plus de 5 ans

#2

Mis à jour par Frédéric Péters il y a plus de 5 ans

Pas fan de se retrouver ainsi avec une méthode nommée store_backoffice_filefield et une autre store_in_backoffice_filefield; si possible je préférerais cette variation (interdiff manuellement écrit dans redmine, pour l'idée, sans être trop attentif) :

        if self.backoffice_filefield_id:
            if (status // 100) == 2 and app_error_code == 0 and status not in (204, 205):
-                self.store_backoffice_filefield(formdata, response, data)
+                filename, content_type = self.get_attachment_data(response)
+                self.store_in_backoffice_filefield(
+                    formdata, self.backoffice_filefield_id,
+                    filename, content_type, data)
#3

Mis à jour par Thomas Noël il y a plus de 5 ans

Parfaitement exact, merci.

Interdiff :

diff --git a/wcs/wf/wscall.py b/wcs/wf/wscall.py
index c44fb2b7..013a8a3a 100644
--- a/wcs/wf/wscall.py
+++ b/wcs/wf/wscall.py
@@ -324,7 +324,10 @@ class WebserviceCallStatusItem(WorkflowStatusItem):

         if self.backoffice_filefield_id:
             if (status // 100) == 2 and app_error_code == 0 and status not in (204, 205):
-                self.store_backoffice_filefield(formdata, response, data)
+                filename, content_type = self.get_attachment_data(response)
+                self.store_in_backoffice_filefield(
+                        formdata, self.backoffice_filefield_id,
+                        filename, content_type, data)

         if app_error_code != 0:
             self.action_on_error(self.action_on_app_error, formdata, response, data=data)
@@ -372,12 +375,6 @@ class WebserviceCallStatusItem(WorkflowStatusItem):
                                                  varname=self.varname)
             formdata.evolution[-1].add_part(attachment)

-    def store_backoffice_filefield(self, formdata, response, data):
-        filename, content_type = self.get_attachment_data(response)
-        self.store_in_backoffice_filefield(
-                formdata, self.backoffice_filefield_id,
-                filename, content_type, data)
-
     def action_on_error(self, action, formdata, response=None, data=None, exc_info=None):
         if action in (':pass', ':stop') and (self.notify_on_errors or self.record_errors):
             if exc_info:
#4

Mis à jour par Frédéric Péters il y a plus de 5 ans

  • Statut changé de Solution proposée à Solution validée

Ack ainsi.

#5

Mis à jour par Thomas Noël il y a plus de 5 ans

  • Statut changé de Solution validée à Résolu (à déployer)
commit f5857ca745df9ec0a71355660ddb0294334394ff
Author: Thomas NOEL <tnoel@entrouvert.com>
Date:   Thu Aug 23 14:20:38 2018 +0200

    wscall: allow storing in backoffice file without varname (#25784)

#6

Mis à jour par Frédéric Péters il y a plus de 5 ans

  • Statut changé de Résolu (à déployer) à Solution déployée

Formats disponibles : Atom PDF