Bug #39919
compat ancien PicklableUpload vs bytes
Début:
16 février 2020
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Oui
Planning:
Non
Description
Exception: type = '<class 'TypeError'>', value = 'initial_value must be str or None, not bytes' Stack trace (most recent call first): File "/usr/lib/python3/dist-packages/wcs/qommon/form.py", line 850, in __setstate__ 848 if hasattr(self, 'data'): 849 # backward compatibility with older w.c.s. version > 850 self.fp = StringIO(self.data) 851 del self.data 852 locals: dict = {'data': b'\xff\xd8\xff\xe1\x00jExif\x00\x00MM\x00*\x00\x00\x00\x08\x00\x04\x01\x00\x00\x04\x00\x00\x00\x01\x00\x00\x10
(je trouve curieux qu'on passe encore par ce code)
Fichiers
Révisions associées
portfolio: don't use PicklableUpload internals (#39919)
Historique
Mis à jour par Frédéric Péters il y a environ 4 ans
- Fichier 0001-misc-use-bytes-in-compatibility-with-older-Picklable.patch 0001-misc-use-bytes-in-compatibility-with-older-Picklable.patch ajouté
- Statut changé de Nouveau à Solution proposée
- Patch proposed changé de Non à Oui
Mis à jour par Benjamin Dauvergne il y a environ 4 ans
Frédéric Péters a écrit :
[...]
(je trouve curieux qu'on passe encore par ce code)
Ça vient de portfolio :
File "/usr/lib/python3/dist-packages/wcs/portfolio.py", line 138, in pick 136 download = PicklableUpload(name, content_type='application/pdf') 137 download.__setstate__({ > 138 'data': document, 139 }) 140 tempfile = get_session().add_tempfile(download)
Il faudrait peut-être ajouter cela à ton patch :
diff --git wcs/portfolio.py wcs/portfolio.py index db56259a..a60a81c6 100644 --- wcs/portfolio.py +++ wcs/portfolio.py @@ -134,9 +134,7 @@ class FargoDirectory(Directory): name = urllib.unquote(path[-1]) from .qommon.form import PicklableUpload download = PicklableUpload(name, content_type='application/pdf') - download.__setstate__({ - 'data': document, - }) + download.receive([document]) tempfile = get_session().add_tempfile(download) return self.set_token(tempfile.get('token'), name) else:
Mis à jour par Frédéric Péters il y a environ 4 ans
- Fichier 0001-portfolio-don-t-use-PicklableUpload-internals-39919.patch 0001-portfolio-don-t-use-PicklableUpload-internals-39919.patch ajouté
Patch supplémentaire, pour utiliser .receive() et tester ce bout.
Mis à jour par Benjamin Dauvergne il y a environ 4 ans
- Statut changé de Solution proposée à Solution validée
Mis à jour par Frédéric Péters il y a environ 4 ans
- Statut changé de Solution validée à Résolu (à déployer)
commit 5e796a278984afaaa82ddd0bd88d0afb550a9feb Author: Frédéric Péters <fpeters@entrouvert.com> Date: Sun Feb 16 15:10:55 2020 +0100 portfolio: don't use PicklableUpload internals (#39919) commit fd2c689626ab4c30a1306097bee918c15b8c01d2 Author: Frédéric Péters <fpeters@entrouvert.com> Date: Sun Feb 16 10:59:14 2020 +0100 misc: use bytes in compatibility with older PicklableUpload (#39919)
Mis à jour par Frédéric Péters il y a environ 4 ans
- Statut changé de Résolu (à déployer) à Solution déployée
misc: use bytes in compatibility with older PicklableUpload (#39919)