Projet

Général

Profil

Bug #20250

''file' object has no attribute 'rewind''

Ajouté par Thomas Noël il y a plus de 6 ans. Mis à jour il y a plus de 5 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Version cible:
-
Début:
24 novembre 2017
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:

Description

Exception:
  type = '<type 'exceptions.AttributeError'>', value = ''file' object has no attribute 'rewind''

Stack trace (most recent call first):
  File "/usr/lib/python2.7/dist-packages/wcs/qommon/misc.py", line 556, in get_thumbnail
   554         # failed to create thumbnail; restore file pointer state and raise
   555         # exception.
>  556         fp.rewind()
   557         raise ThumbnailError()
   558     return image_thumb_fp.getvalue()

  locals:
     fp = <open file '/var/lib/wcs/vandoeuvre.au-quotidien.com/uploads/99c5babd7b58897b5b28758d5ca71d9e83c910329915e03e01b1fec611eeaa27', mode 'r' at 0x7f6fa0
aef300>
     image_thumb_fp = <cStringIO.StringO object at 0x7f6fa2049ab0>
     image = <PIL.JpegImagePlugin.JpegImageFile image mode=CMYK size=450x300 at 0x7F6FAF135908>

  File "/usr/lib/python2.7/dist-packages/wcs/forms/common.py", line 91, in _q_lookup
    89                 thumbnail = misc.get_thumbnail(fp)
    90             except misc.ThumbnailError:
>   91                 pass
    92             else:
    93                 response.set_content_type('image/png')

  locals:
     fp = <open file '/var/lib/wcs/vandoeuvre.au-quotidien.com/uploads/99c5babd7b58897b5b28758d5ca71d9e83c910329915e03e01b1fec611eeaa27', mode 'r' at 0x7f6fa0
aef300>
     lookup_method = <bound method FileDirectory.lookup_file_field of <wcs.forms.common.FileDirectory object at 0x7f6fa0c3f050>>
     lookup_method_name = 'lookup_file_field'
     self = <wcs.forms.common.FileDirectory object at 0x7f6fa0c3f050>
     component = '0.1 Francois Fr__d__ric .jpg'
     upload = None
     file = <PicklableUpload at 7f6fa126ec20: 0.1 Francois Frédéric .jpg>
     response = <wcs.qommon.http_response.HTTPResponse instance at 0x7f6fa1a89560>

Fichiers

Révisions associées

Révision e9976a03 (diff)
Ajouté par Thomas Noël il y a plus de 6 ans

misc: use fp.seek(0) to rewind a file (#20250)

Historique

#1

Mis à jour par Thomas Noël il y a plus de 6 ans

passé au travers des mailles de ma relecture, sans doute... j'imagine remplacer par seek(0) comme partout ailleurs dans le code.

#2

Mis à jour par Frédéric Péters il y a plus de 6 ans

Ok, à passer en hotfix ?

#3

Mis à jour par Thomas Noël il y a plus de 6 ans

  • Statut changé de En cours à Résolu (à déployer)

push + tag hotfix 2.26

commit e9976a03ff8b3f12893c191aca476a995b9cdfe7 (HEAD -> master, tag: v2.26, origin/master, origin/HEAD)
Author: Thomas NOEL <tnoel@entrouvert.com>
Date:   Fri Nov 24 10:12:35 2017 +0100

    misc: use fp.seek(0) to rewind a file (#20250)

#4

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

Formats disponibles : Atom PDF