Projet

Général

Profil

Bug #55684

Caluire Axel: crash à la liaison

Ajouté par Nicolas Roche il y a presque 3 ans. Mis à jour il y a presque 3 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Version cible:
-
Début:
19 juillet 2021
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:
Non

Description

File "/usr/lib/python3/dist-packages/passerelle/utils/jsonresponse.py" in api
  128.             resp = f(*args, **kwargs)

File "/usr/lib/python3/dist-packages/passerelle/views.py" in perform
  521.         result = self.endpoint(request, **params)

File "/usr/lib/python3/dist-packages/passerelle/contrib/caluire_axel/models.py" in link
  109.             data, result = self.check_individu(post_data)

File "/usr/lib/python3/dist-packages/passerelle/contrib/caluire_axel/models.py" in check_individu
  77.             for famille in individu['FAMILLE']:

Exception Type: KeyError at /caluire-axel/axel/link
Exception Value: 'FAMILLE'

Fichiers

Révisions associées

Révision 1bcc9cf0 (diff)
Ajouté par Nicolas Roche il y a presque 3 ans

caluire-axel: allow individual with no family (#55684)

Révision 1f514ae1 (diff)
Ajouté par Nicolas Roche il y a presque 3 ans

caluire-axel: allow individual with no family (#55684)

Historique

#3

Mis à jour par Nicolas Roche il y a presque 3 ans

Cf Individu.xsd, un individu peut ne pas avoir de famille :

    <xsd:complexType name="INDIVIDUType">
        <xsd:sequence>
            <xsd:element name="IDENT" type="all:IDENTType"/>
    ...
            <xsd:element name="FAMILLE" type="ind:FAMILLEType" minOccurs="0" maxOccurs="unbounded"/><!-- CUSTOM -->
        </xsd:sequence> 
    </xsd:complexType>
</xsd:schema>

(Après, ce XSD a été amendé (#<!-- CUSTOM -->) (#53825) pour le faire correspondre avec ce qu'Axel nous renvoie effectivement.)

#5

Mis à jour par Thomas Noël il y a presque 3 ans

Le code va renvoyer une APIError "Person not found", mais ce n'est pas l'erreur rencontrée. Il faudrait plutôt à mon sens renvoyer une APIError genre "Person without family" avec quelque chose du genre

if not individu.get('FAMILLE'):
   raise APIError('Person without family', err_code='person-without-family')

à poser avant le for.

#6

Mis à jour par Thomas Noël il y a presque 3 ans

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

J'ai dit n'importe quoi, c'est ton code qui est le bon (on passe silencieusement sur les individus sans famille, sans rien dire).

#7

Mis à jour par Nicolas Roche il y a presque 3 ans

  • Statut changé de Solution validée à Résolu (à déployer)
  • Assigné à mis à Nicolas Roche
commit 1bcc9cf07db08ce6d467c5e32f2d13fee5067aeb
Author: Nicolas ROCHE <nroche@entrouvert.com>
Date:   Tue Jul 20 09:27:18 2021 +0200

    caluire-axel: allow individual with no family (#55684)
#8

Mis à jour par Frédéric Péters il y a presque 3 ans

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

Formats disponibles : Atom PDF