Project

General

Profile

Development #56997

TypeError: expected string or bytes-like object

Added by sentry io about 1 month ago. Updated 19 days ago.

Status:
Solution déployée
Priority:
Normal
Target version:
-
Start date:
16 Sep 2021
Due date:
% Done:

0%

Estimated time:
Patch proposed:
Yes
Planning:
No

Description

https://sentry.entrouvert.org/entrouvert/gplexpert/issues/52163/

TypeError: expected string or bytes-like object
(13 additional frame(s) were not displayed)
...
  File "quixote/directory.py", line 82, in _q_traverse
    obj = self._q_lookup(component)
  File "wcs/admin/fields.py", line 238, in _q_lookup
    d = self.field_def_page_class(self.objectdef, component)
  File "wcs/admin/fields.py", line 50, in __init__
    label = misc.ellipsize(self.field.unhtmled_label, 40)
  File "wcs/fields.py", line 290, in unhtmled_label
    return force_str(html.unescape(force_text(re.sub('<.*?>', ' ', self.label or ''))).strip())
  File "re.py", line 192, in sub
    return _compile(pattern, flags).sub(repl, string, count)

Files

Associated revisions

Revision 5f938260 (diff)
Added by Benjamin Dauvergne 19 days ago

admin: do not store a lazy string in Field.label (#56997)

History

#1

Updated by Benjamin Dauvergne about 1 month ago

  • Project changed from Suivi des traces to w.c.s.

Encore une chaîne localisée passée à une fonction de la lib standard, ici re.sub, la dernière fois c'était str.join(), #56008.

#2

Updated by Benjamin Dauvergne about 1 month ago

  • Assignee set to Benjamin Dauvergne
#3

Updated by Benjamin Dauvergne about 1 month ago

#5

Updated by Benjamin Dauvergne 23 days ago

Branche rebasée.

#6

Updated by Nicolas Roche 23 days ago

ici re.sub, la dernière fois c'était str.join(),

si je te suis, ce ne serait pas plutôt self.label qu'il faudrait caster ?

>>> class truc():
...   pass
... 
>>> label = truc()
>>> re.sub('<.*?>', ' ', label)
TypeError: expected string or bytes-like object

#7

Updated by Benjamin Dauvergne 23 days ago

Oui, pas bien réveillé j'étais. Je suis remonté à la source de la chaîne paresseuse.

#8

Updated by Nicolas Roche 20 days ago

  • Status changed from Solution proposée to Solution validée

(oui, on voit sur sentry que ça plante sur la chaîne 'Aucun')

#9

Updated by Benjamin Dauvergne 19 days ago

  • Status changed from Solution validée to Résolu (à déployer)
commit 5f938260b80c6e57a4dfbf1efe5f4a3b7f242100
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Thu Sep 16 12:22:47 2021 +0200

    admin: do not store a lazy string in Field.label (#56997)
#10

Updated by Frédéric Péters 19 days ago

  • Status changed from Résolu (à déployer) to Solution déployée

Also available in: Atom PDF