Project

General

Profile

Development #32236

crash sur /accounts/delete/

Added by Frédéric Péters 7 days ago. Updated 3 days ago.

Status:
Solution déployée
Priority:
Normal
Category:
-
Target version:
-
Start date:
12 Apr 2019
Due date:
% Done:

100%

Patch proposed:
Yes
Planning:
No

Description

Suite à l'envoi d'un email, #26910.

File "/usr/lib/python2.7/dist-packages/authentic2/registration_backend/views.py" in form_valid
  392.         utils.send_account_deletion_mail(self.request, self.request.user)

File "/usr/lib/python2.7/dist-packages/authentic2/utils.py" in send_account_deletion_mail
  715.     send_templated_mail(user.email, template_names, context, request=request)

File "/usr/lib/python2.7/dist-packages/authentic2/utils.py" in send_templated_mail
  606.     subject = render_to_string(subject_template_names, ctx, request=request).strip()

File "/usr/lib/python2.7/dist-packages/django/template/loader.py" in render_to_string
  65.         template = select_template(template_name, using=using)

File "/usr/lib/python2.7/dist-packages/django/template/loader.py" in select_template
  48.                 return engine.get_template(template_name)

File "/usr/lib/python2.7/dist-packages/django/template/backends/django.py" in get_template
  39.             return Template(self.engine.get_template(template_name), self)

File "/usr/lib/python2.7/dist-packages/django/template/engine.py" in get_template
  162.         template, origin = self.find_template(template_name)

File "/usr/lib/python2.7/dist-packages/django/template/engine.py" in find_template
  136.                         name, template_dirs=dirs, skip=skip,

File "/usr/lib/python2.7/dist-packages/django/template/loaders/base.py" in get_template
  32.         for origin in self.get_template_sources(*args):

File "/usr/lib/python2.7/dist-packages/hobo/multitenant/template_loader.py" in get_template_sources
  71.             known_template_names = ['variants/%s/%s' % (theme_value, template_name), template_name]

Exception Type: UnicodeDecodeError at /accounts/delete/
Exception Value: 'ascii' codec can't decode byte 0xc3 in position 50: ordinal not in range(128)

0001-utils-use-ou-slug-in-template-names-for-mails-fixes-.patch View (1.02 KB) Benjamin Dauvergne, 12 Apr 2019 01:37 PM

Associated revisions

Revision 3ead3d2e (diff)
Added by Benjamin Dauvergne 7 days ago

utils: use ou slug in template names for mails (fixes #32236)

History

#1 Updated by Benjamin Dauvergne 7 days ago

Vu, ça vient de cette ligne :

        'authentic2/account_delete_notification_%s' % user.ou,

c'est le slug qu'il faut utiliser pas l'ou elle même qui donnera son nom et qui peut donc contenir des caractères hors ASCII.

#2 Updated by Benjamin Dauvergne 7 days ago

  • Assignee set to Benjamin Dauvergne

#3 Updated by Benjamin Dauvergne 7 days ago

Pas possible d'en faire un test, ça vient de l'interaction entre l'utilisation
récente de @python_2_unicode_compatible (qui crée un str() renvoyant de
l'UTF-8) et le loader dans hobo qui a un theme_value venant d'un JSON et donc unicode et ça fait:

'variant/%s/%s' % (theme_value, template_name)

mélange unicode et str en UTF-8, pas bon.

#4 Updated by Paul Marillonnet 7 days ago

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

Benjamin Dauvergne a écrit :

c'est le slug qu'il faut utiliser pas l'ou elle même qui donnera son nom et qui peut donc contenir des caractères hors ASCII.

Oui, ma faute. Merci pour la correction.

#5 Updated by Benjamin Dauvergne 7 days ago

  • Status changed from Solution validée to Résolu (à déployer)
commit 3ead3d2ee37e4592bfebe2e600aa76bf302fd8e2
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Fri Apr 12 13:35:25 2019 +0200

    utils: use ou slug in template names for mails (fixes #32236)

#6 Updated by Benjamin Dauvergne 7 days ago

  • % Done changed from 0 to 100

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

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

Also available in: Atom PDF