Project

General

Profile

Bug #44464

passerelle-montpellier-sig: 'in <string>' requires string as left operand, not bytes

Added by Serghei Mihai 10 days ago. Updated 10 days ago.

Status:
Résolu (à déployer)
Priority:
Normal
Assignee:
Target version:
-
Start date:
25 Jun 2020
Due date:
% Done:

0%

Patch proposed:
Yes
Planning:
No

Description

Après la mise à jour de la prod:

Internal Server Error: /montpellier-sig/hebe/voies/34172

TypeError at /montpellier-sig/hebe/voies/34172
'in <string>' requires string as left operand, not bytes

Request Method: GET
Request URL: https://passerelle.montpellier3m.fr/montpellier-sig/hebe/voies/34172?callback=jQuery110207459028756863553_1593121790663&q=Xavier+montrouzier&_=1593121790664
Django Version: 1.11.20
Python Executable: /usr/bin/uwsgi-core
Python Version: 3.5.3
Python Path: ['.', '', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages']
Server time: jeu, 25 Jui 2020 23:55:54 +0200
Installed Applications:
''
Installed Middleware:
''

Traceback:  

File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/usr/lib/python3/dist-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/usr/lib/python3/dist-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/usr/lib/python3/dist-packages/passerelle/urls_utils.py" in f
  54.             return func(request, *args, **kwargs)

File "/usr/lib/python3/dist-packages/django/views/generic/base.py" in view
  68.             return self.dispatch(request, *args, **kwargs)

File "/usr/lib/python3/dist-packages/django/views/generic/base.py" in dispatch
  88.         return handler(request, *args, **kwargs)

File "/usr/lib/python3/dist-packages/passerelle_montpellier_sig/views.py" in get
  153.             voies = [v for v in voies if q in v['text']]

File "/usr/lib/python3/dist-packages/passerelle_montpellier_sig/views.py" in <listcomp>
  153.             voies = [v for v in voies if q in v['text']]

0001-py3-convert-query-string-to-text-44464.patch View (1.22 KB) Serghei Mihai, 26 Jun 2020 12:05 AM

0001-py3-convert-encode-query-to-text-44464.patch View (1.15 KB) Serghei Mihai, 26 Jun 2020 12:38 AM

0001-py3-convert-encode-query-to-text-44464.patch View (1.04 KB) Serghei Mihai, 26 Jun 2020 10:51 AM

History

#1 Updated by Serghei Mihai 10 days ago

#2 Updated by Thomas Noël 10 days ago

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

#3 Updated by Serghei Mihai 10 days ago

  • Assignee set to Serghei Mihai
  • Status changed from Solution validée to Résolu (à déployer)
commit 394560a9e4e1d841dcd08dbccec8ca72a640ae59 (origin/master, origin/HEAD)
Author: Serghei Mihai <smihai@entrouvert.com>
Date:   Fri Jun 26 00:03:33 2020 +0200

    py3: convert query string to text (#44464)

#4 Updated by Serghei Mihai 10 days ago

parce que c'est

q = unicodedata.normalize('NFKD', q).encode('ascii', 'ignore')

qui transforme q en bytes.

#5 Updated by Frédéric Péters 10 days ago

C'est un peu dommage de l'appeler à chaque itération plutôt qu'une seule fois la ligne au-dessus.

#7 Updated by Frédéric Péters 10 days ago

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

#8 Updated by Serghei Mihai 10 days ago

  • Status changed from Solution validée to Résolu (à déployer)
commit 300812c3b88ea1439182174368af9b79d3bad507 (origin/master, origin/HEAD)
Author: Serghei Mihai <smihai@entrouvert.com>
Date:   Fri Jun 26 00:37:38 2020 +0200

    py3: convert encode query to text (#44464)

Also available in: Atom PDF