mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #486 -- Fixed bug in template filter parsing in edge cases, and added unit tests. Thanks, Simon
git-svn-id: http://code.djangoproject.com/svn/django/trunk@634 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -295,13 +295,14 @@ class FilterParser:
|
||||
if registered_filters[filter_name][1] == True and arg is None:
|
||||
raise TemplateSyntaxError, "Filter '%s' requires an argument" % filter_name
|
||||
if registered_filters[filter_name][1] == False and arg is not None:
|
||||
raise TemplateSyntaxError, "Filter '%s' should not have an argument" % filter_name
|
||||
raise TemplateSyntaxError, "Filter '%s' should not have an argument (argument is %r)" % (filter_name, arg)
|
||||
self.filters.append((filter_name, arg))
|
||||
if self.current is None:
|
||||
break
|
||||
|
||||
def read_filter(self):
|
||||
self.current_filter_name = self.read_alphanumeric_token()
|
||||
self.current_filter_arg = None
|
||||
# Have we reached the end?
|
||||
if self.current is None:
|
||||
return (self.current_filter_name, None)
|
||||
|
||||
Reference in New Issue
Block a user