Bug #20396
crash sur l'ajout d'un commentaire en gabarit Django
Statut:
Fermé
Priorité:
Immediat
Assigné à:
-
Version cible:
-
Début:
01 décembre 2017
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Oui
Planning:
Description
Sur un formulaire, ajout d'un commentaire "{% if True }Django{ endif %}"
Résultat immédiat à l'affichage de https://demo.dev.au-quotidien.com/backoffice/forms/278/ :
Exception: type = '<type 'exceptions.UnicodeDecodeError'>', value = ''ascii' codec can't decode byte 0xc3 in position 5: ordinal not in range(128)' Stack trace (most recent call first): File "/usr/lib/python2.7/dist-packages/wcs/admin/forms.py", line 510, in _q_index 508 r += self.get_preview() 509 r += htmltext('</div>') > 510 return r.getvalue() 511 512 def _get_roles_label(self, attribute): locals: online_status = 'D\xc3\xa9sactiv\xc3\xa9e' self = <wcs.admin.forms.FormDefPage object at 0x7f740c8e7a90> add_option_line = <function add_option_line at 0x7f740c9468c0> role_id = None r = <TemplateIO object at 0x7f740c9cabb0> wf_role_id = '_receiver' wf_role_label = 'Destinataire' warning_class = '' role_label = '-'
Fichiers
Révisions associées
Historique
Mis à jour par Thomas Noël il y a plus de 6 ans
diff --git a/wcs/qommon/template.py b/wcs/qommon/template.py index 51a611f1..2baf8cb7 100644 --- a/wcs/qommon/template.py +++ b/wcs/qommon/template.py @@ -484,13 +484,14 @@ class Template(object): def django_render(self, context={}): context = DjangoContext(context) try: - return self.template.render(context) + rendered = self.template.render(context) except (DjangoTemplateSyntaxError, DjangoVariableDoesNotExist) as e: if self.raises: from qommon import _ raise TemplateError(_('failure to render Django template: %s'), e) else: return self.value + return rendered.encode(get_publisher().site_charset) def ezt_render(self, context={}): fd = StringIO()
(écriture de tests en cours)
Mis à jour par Thomas Noël il y a plus de 6 ans
- Fichier 0001-encode-Django-templates-render-20396.patch 0001-encode-Django-templates-render-20396.patch ajouté
- Statut changé de Nouveau à En cours
- Priorité changé de Normal à Immediat
- Patch proposed changé de Non à Oui
Mis à jour par Thomas Noël il y a plus de 6 ans
- Statut changé de En cours à Résolu (à déployer)
commit 47ca25760f02ca1d4e4232442c23e3a1a25f1267 (HEAD -> master, origin/master, origin/HEAD) Author: Thomas NOEL <tnoel@entrouvert.com> Date: Sat Dec 2 03:15:38 2017 +0100 encode Django templates render (#20396)
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
encode Django templates render (#20396)