Projet

Général

Profil

Bug #31823

Mis à jour par Nicolas Roche il y a plus de 4 ans

Voici un worflow formulaire (exporté d'Arles) qui contient des champs vides ce qui pose problème à l'import
et génère une erreur 500 (Internal Serveur Error).
Tout rentre dans l'ordre une fois que tous les tags '<item />' sont supprimés.

Voici les champs incriminés :
<pre>
<item>{{form_var_telephone}}</item>
<item />
<item />
...
</pre>

Et voici la trace de Wcs :
<pre>
Stack trace (most recent call first):
File "/home/nroche/src/wcs/wcs/workflows.py", line 825, in init_with_xml
823 if list(el):
824 if type(getattr(self, attribute)) is list:
> 825 v = [x.text.encode(charset) for x in el]
826 elif type(getattr(self, attribute)) is dict:
827 v = {}

(Pdb) [x.text for x in el]
['{{form_var_telephone}}', None, None, None, None, None, None]
</pre>

Cette correction permet de poursuivre l'import :
<pre>
diff --git a/wcs/workflows.py b/wcs/workflows.py
index d1f6980f..7c3aae25 100644
--- a/wcs/workflows.py
+++ b/wcs/workflows.py
@@ -822,7 +822,7 @@ class XmlSerialisable(object):
continue
if list(el):
if type(getattr(self, attribute)) is list:
- v = [x.text.encode(charset) for x in el]
+ v = [x.text.encode(charset) for x in el if x]
elif type(getattr(self, attribute)) is dict:
v = {}
for e in el:

</pre>

Retour