1
0
mirror of https://github.com/django/django.git synced 2025-07-04 09:49:12 +00:00

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
This commit is contained in:
Georg Bauer 2005-10-11 12:20:37 +00:00
parent f882f3eea9
commit 0cd2968973

View File

@ -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):