From 0cd2968973427d83f7fef4fe120eaae824423f3e Mon Sep 17 00:00:00 2001 From: Georg Bauer Date: Tue, 11 Oct 2005 12:20:37 +0000 Subject: [PATCH] i18n: enhanced the filter-argument-parser to parse _("") strings, too git-svn-id: http://code.djangoproject.com/svn/django/branches/i18n@834 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/template.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/django/core/template.py b/django/core/template.py index 11ce3b2ce1..6c7c850d18 100644 --- a/django/core/template.py +++ b/django/core/template.py @@ -363,6 +363,13 @@ class FilterParser: def read_arg(self): # First read a " self.next_char() + translated = False + if self.current == '_': + self.next_char() + if self.current != '(': + raise TemplateSyntaxError, "Bad character (expecting '(') '%s'" % self.current + translated = True + self.next_char() if self.current != '"': raise TemplateSyntaxError, "Bad character (expecting '\"') '%s'" % self.current self.escaped = False @@ -389,6 +396,10 @@ class FilterParser: arg += self.current # self.current must now be '"' self.next_char() + if translated: + if self.current != ')': + raise TemplateSyntaxError, "Bad character (expecting ')') '%s'" % self.current + self.next_char() return arg def get_filters_from_token(token):