From 432339a72c20f78abf1999892a39c71b5d853174 Mon Sep 17 00:00:00 2001 From: Julien Phalip Date: Mon, 28 May 2012 11:03:34 -0700 Subject: [PATCH] Fixed #18393 -- Prevented blocktrans to crash when a variable name is badly formatted. --- django/templatetags/i18n.py | 2 +- .../i18n/other/locale/fr/LC_MESSAGES/django.mo | Bin 454 -> 528 bytes .../i18n/other/locale/fr/LC_MESSAGES/django.po | 6 ++++++ tests/regressiontests/i18n/tests.py | 16 +++++++++++++++- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/django/templatetags/i18n.py b/django/templatetags/i18n.py index ca79f41edc0..e090781080d 100644 --- a/django/templatetags/i18n.py +++ b/django/templatetags/i18n.py @@ -148,7 +148,7 @@ class BlockTranslateNode(Node): context.pop() try: result = result % data - except KeyError: + except (KeyError, ValueError): with translation.override(None): result = self.render(context) return result diff --git a/tests/regressiontests/i18n/other/locale/fr/LC_MESSAGES/django.mo b/tests/regressiontests/i18n/other/locale/fr/LC_MESSAGES/django.mo index f0a21797676abbe377b4637c57fe40fce594a5b2..478338bc886a2445f9a1c7004b49f4bac719d5fb 100644 GIT binary patch delta 144 zcmX@cJb@+lo)F7a1|VPtVi_Pd0b*7l_5orLNC09nAWj5gkbDIYJ2NscfHX-0@l7Bb zB>ovl0}%rg5W@iTL|