Bug #37512
crash sur attribution de rôle lors d'un get_computed_role_id qiu renvoie None
Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Version cible:
-
Début:
07 novembre 2019
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Oui
Planning:
Non
Description
Il faut rendre get_computed_role_id résistante à une évaluation Python qui renvoie un truc bizarre (ici None, peut-être voire d'autres cas, ou pas)
type = '<type 'exceptions.AttributeError'>', value = ''NoneType' object has no attribute 'startswith'' Stack trace (most recent call first): File "/usr/lib/python2.7/posixpath.py", line 68, in join 66 path = a 67 for b in p: > 68 if b.startswith('/'): 69 path = b 70 elif path == '' or path.endswith('/'): locals: a = '/var/lib/wcs/demarches.mesdemarches06.fr/roles' b = None p = (None,) path = '/var/lib/wcs/demarches.mesdemarches06.fr/roles' File "/usr/lib/python2.7/dist-packages/wcs/qommon/storage.py", line 297, in has_key 295 @classmethod 296 def has_key(cls, id): > 297 filename = os.path.join(cls.get_objects_dir(), fix_key(id)) 298 return os.path.exists(filename) 299 locals: cls = <class 'wcs.roles.Role'> id = None File "/usr/lib/python2.7/dist-packages/wcs/workflows.py", line 1892, in get_computed_role_id 1890 def get_computed_role_id(self, role_id): 1891 new_role_id = self.compute(str(role_id)) > 1892 if Role.has_key(new_role_id): 1893 return new_role_id 1894 # computed value, not an id, try to get role by slug locals: new_role_id = None role_id = '=form_var_email'
Fichiers
Révisions associées
Historique
Mis à jour par Frédéric Péters il y a plus de 2 ans
- Fichier 0001-workflows-don-t-try-to-load-a-role-with-None-as-id-3.patch 0001-workflows-don-t-try-to-load-a-role-with-None-as-id-3.patch ajouté
- Statut changé de Nouveau à Solution proposée
- Patch proposed changé de Non à Oui
(depuis le code de la trace il y a eu des changements et .get appelé plutôt que .has_key et ça évitait le problème, voici quand même un patch).
Mis à jour par Thomas Noël il y a plus de 2 ans
- Statut changé de Solution proposée à Solution validée
Ceinture, bretelles, impec.
Mis à jour par Frédéric Péters il y a plus de 2 ans
- Statut changé de Solution validée à Résolu (à déployer)
commit d55d2da0eea3ad987bbf8e68f951a61bb5ce3ad2 Author: Frédéric Péters <fpeters@entrouvert.com> Date: Sat Oct 23 19:24:45 2021 +0200 workflows: don't try to load a role with None as id (#37512)
Mis à jour par Frédéric Péters il y a plus de 2 ans
- Statut changé de Résolu (à déployer) à Solution déployée
workflows: don't try to load a role with None as id (#37512)