Bug #15504
api: submit d'un champ "carte" vide
Début:
20 mars 2017
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Oui
Planning:
Description
Exception: type = '<type 'exceptions.TypeError'>', value = 'argument of type 'NoneType' is not iterable' Stack trace (most recent call first): File "/usr/lib/python2.7/dist-packages/wcs/fields.py", line 1897, in from_json_value 1895 1896 def from_json_value(self, value): > 1897 if 'lat' in value and 'lon' in value: 1898 return '%s;%s' % (float(value['lat']), float(value['lon'])) 1899 else: locals: self = <wcs.fields.MapField object at 0x7fdaa16b6690> value = None File "/usr/lib/python2.7/dist-packages/wcs/api.py", line 64, in posted_json_data_to_formdata_data 62 if not field.id in data: 63 continue > 64 data[field.id] = field.from_json_value(data[field.id]) 65 66 return data
Fichiers
Révisions associées
Historique
Mis à jour par Frédéric Péters il y a environ 7 ans
- Fichier 0001-api-fix-submission-of-empty-map-field-data-15504.patch 0001-api-fix-submission-of-empty-map-field-data-15504.patch ajouté
- Statut changé de Nouveau à En cours
- Patch proposed changé de Non à Oui
Mis à jour par Thomas Noël il y a environ 7 ans
Je préférerais que MapField.from_json_value s'adapte en commençant son "if" par "if value ...", comme celui de FileField.
Ca me parait moins radical.
Mis à jour par Frédéric Péters il y a environ 7 ans
J'ai hésité mais faut alors aussi le faire pour DateField et puis y penser systématiquement, je préfère couper à la source.
Mis à jour par Thomas Noël il y a environ 7 ans
Frédéric Péters a écrit :
J'ai hésité mais faut alors aussi le faire pour DateField et puis y penser systématiquement, je préfère couper à la source.
Je tatillonne : c'est fait aussi pour DateField via le except TypeError: return None
Mais bon, à relire et un peu projeter l'affaire : ack.
Mis à jour par Frédéric Péters il y a environ 7 ans
- Statut changé de En cours à Résolu (à déployer)
Merci,
commit 4a51316f09fdea76e30f4190af36f6240b7da917 Author: Frédéric Péters <fpeters@entrouvert.com> Date: Mon Mar 20 09:44:47 2017 +0100 api: fix submission of empty map field data (#15504)
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
api: fix submission of empty map field data (#15504)