summaryrefslogtreecommitdiff
path: root/django/template/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/template/__init__.py')
-rw-r--r--django/template/__init__.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/django/template/__init__.py b/django/template/__init__.py
index 08f433fec9..993de7304e 100644
--- a/django/template/__init__.py
+++ b/django/template/__init__.py
@@ -318,7 +318,7 @@ class Parser(object):
self.tags.update(lib.tags)
self.filters.update(lib.filters)
- def compile_filter(self,token):
+ def compile_filter(self, token):
"Convenient wrapper for FilterExpression"
return FilterExpression(token, self)
@@ -543,11 +543,14 @@ class FilterExpression(object):
raise TemplateSyntaxError, "Could not parse the remainder: %s" % token[upto:]
self.var, self.filters = var, filters
- def resolve(self, context):
+ def resolve(self, context, ignore_failures=False):
try:
obj = resolve_variable(self.var, context)
except VariableDoesNotExist:
- obj = settings.TEMPLATE_STRING_IF_INVALID
+ if ignore_failures:
+ return None
+ else:
+ return settings.TEMPLATE_STRING_IF_INVALID
for func, args in self.filters:
arg_vals = []
for lookup, arg in args: