Bug #16073
Visualisation d'un fichier None
Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Version cible:
-
Début:
28 avril 2017
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Oui
Planning:
Description
Exception: type = '<type 'exceptions.AttributeError'>', value = ''NoneType' object has no attribute 'base_filename'' Stack trace (most recent call first): File "/usr/lib/python2.7/dist-packages/wcs/fields.py", line 776, in get_view_value 774 def get_view_value(self, value): 775 return htmltext('<a download="%s" href="[download]?f=%s">%s</a>') % ( > 776 value.base_filename, self.id, value) 777 778 def get_csv_value(self, value, hint=None, **kwargs): locals: self = <wcs.fields.FileField object at 0x7f5a1aa36d90> value = None File "/usr/lib/python2.7/dist-packages/wcs/fields.py", line 434, in get_view_short_value 432 433 def get_view_short_value(self, value, max_len = 30): > 434 return self.get_view_value(value) 435 436 def get_csv_value(self, element, **kwargs): locals: max_len = 8 self = <wcs.fields.FileField object at 0x7f5a1aa36d90> value = None
Fichiers
Révisions associées
Historique
Mis à jour par Frédéric Péters il y a presque 7 ans
- Fichier 0001-fields-return-empty-string-as-visualisation-of-empty.patch 0001-fields-return-empty-string-as-visualisation-of-empty.patch ajouté
- Statut changé de Nouveau à En cours
- Patch proposed changé de Non à Oui
C'est plutôt moche, j'ai appliqué ça sur prod saas et 3m.
Mis à jour par Frédéric Péters il y a presque 7 ans
- Fichier 0001-formdata-return-empty-string-as-view-value-for-None-.patch 0001-formdata-return-empty-string-as-view-value-for-None-.patch ajouté
En fait c'est à faire un peu plus haut, pour couvrir tous les types de champ (là j'ai par exemple noté des <a href="mailto:None">None</a> dans des listings).
Mis à jour par Frédéric Péters il y a presque 7 ans
- Fichier 0001-formdata-return-empty-string-as-view-value-for-None-.patch 0001-formdata-return-empty-string-as-view-value-for-None-.patch ajouté
On peut même alors laisser .get('...') retourner None.
Mis à jour par Frédéric Péters il y a presque 7 ans
(également posé sur la recette du SaaS et de 3M).
Mis à jour par Frédéric Péters il y a presque 7 ans
- Statut changé de En cours à Résolu (à déployer)
commit 29704b16408f22d9accae8f769196e0440dc96d2 Author: Frédéric Péters <fpeters@entrouvert.com> Date: Fri Apr 28 10:59:04 2017 +0200 formdata: return empty string as view value for None fields (#16073)
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
formdata: return empty string as view value for None fields (#16073)