summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Bauer <gb@hugo.westfalen.de>2005-10-11 12:20:37 +0000
committerGeorg Bauer <gb@hugo.westfalen.de>2005-10-11 12:20:37 +0000
commit0cd2968973427d83f7fef4fe120eaae824423f3e (patch)
treead6a6f43c13e0df3ab8a0806b9ab61ba89cb9a07
parentf882f3eea9c25faf7c47757e67cdb998e2a09f87 (diff)
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
-rw-r--r--django/core/template.py11
1 files changed, 11 insertions, 0 deletions
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):