Bug #42236
fichiers stoqués "opaque" vs nettoyage
Début:
29 avril 2020
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Oui
Planning:
Non
Description
Exception: type = '<class 'TypeError'>', value = 'join() argument must be str or bytes, not 'NoneType'' Stack trace (most recent call first): File "/usr/lib/python3.5/genericpath.py", line 143, in _check_arg_types 141 else: 142 raise TypeError('%s() argument must be str or bytes, not %r' % > 143 (funcname, s.__class__.__name__)) from None 144 if hasstr and hasbytes: 145 raise TypeError("Can't mix strings and bytes in path components") from None File "/usr/lib/python3.5/posixpath.py", line 89, in join 87 path += sep + b 88 except (TypeError, AttributeError, BytesWarning): > 89 genericpath._check_arg_types('join', a, *p) 90 raise 91 return path File "/usr/lib/python3/dist-packages/wcs/qommon/upload_storage.py", line 65, in get_filename 63 raise AttributeError('filename') 64 basedir = os.path.join(get_publisher().app_dir, 'uploads') > 65 return os.path.join(basedir, self.qfilename) 66 67 def get_content(self): File "/usr/lib/python3/dist-packages/wcs/formdef.py", line 1609, in accumulate_filenames 1607 (formdata.workflow_data or {}).values()): 1608 if is_upload(field_data): > 1609 yield field_data.get_filename() 1610 for part in formdata.iter_evolution_parts(): 1611 if is_attachment(part):
Fichiers
Révisions associées
upload_storage: clarify get_filename function, renaming it get_fs_filename (#42236)
Historique
Mis à jour par Thomas Noël il y a environ 4 ans
- Fichier 0001-upload_storage-handle-empty-qfilename-for-non-local-.patch 0001-upload_storage-handle-empty-qfilename-for-non-local-.patch ajouté
- Statut changé de Nouveau à Solution proposée
- Patch proposed changé de Non à Oui
Mis à jour par Frédéric Péters il y a environ 4 ans
Je pense que je serais plus à l'aise avec juste
def get_filename(self): + if hasattr(self, 'storage_attrs'): # alternative storage + return None if not hasattr(self, 'qfilename'): raise AttributeError('filename')
(pour reprendre le code comme il est dans get_content) (même s'il y aurait à redire et qu'on pourrait imaginer à un moment qu'il y ait une autre classe de stockage local et que cette condition se révélera alors un vilain raccourci à revoir).
(je serais aussi presque à suggérer de renommer la méthode en get_fs_filepath(), pour ne pas confondre le nom communiqué là avec le "nom de fichier" affiché à l'usager).
Mis à jour par Thomas Noël il y a environ 4 ans
- Fichier 0002-upload_storage-clarify-get_filename-function-renamin.patch 0002-upload_storage-clarify-get_filename-function-renamin.patch ajouté
- Fichier 0001-upload_storage-handle-empty-qfilename-for-non-local-.patch 0001-upload_storage-handle-empty-qfilename-for-non-local-.patch ajouté
Yep, ça rend les choses un peu plus lisibles ainsi.
Mis à jour par Frédéric Péters il y a environ 4 ans
- Statut changé de Solution proposée à Solution validée
Mis à jour par Thomas Noël il y a environ 4 ans
- Statut changé de Solution validée à Résolu (à déployer)
commit d66eab7cd92889360158b1b532ba6ec52daeb9d1 Author: Thomas NOEL <tnoel@entrouvert.com> Date: Sun May 3 16:42:22 2020 +0200 upload_storage: clarify get_filename function, renaming it get_fs_filename (#42236) commit 3827c81c1d81a7cdb0cf87655750aa8b410735af Author: Thomas NOEL <tnoel@entrouvert.com> Date: Wed Apr 29 10:50:05 2020 +0200 upload_storage: handle empty qfilename, for non-local storage (#42236)
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
upload_storage: handle empty qfilename, for non-local storage (#42236)