1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #15791 - method to signal that callable objects should not be called in templates

Thanks to ejucovy for the suggestion and patch!

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16045 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Luke Plant
2011-04-19 22:06:19 +00:00
parent 9587235530
commit 1286d78311
4 changed files with 127 additions and 3 deletions

View File

@@ -692,7 +692,9 @@ class Variable(object):
):
raise VariableDoesNotExist("Failed lookup for key [%s] in %r", (bit, current)) # missing attribute
if callable(current):
if getattr(current, 'alters_data', False):
if getattr(current, 'do_not_call_in_templates', False):
pass
elif getattr(current, 'alters_data', False):
current = settings.TEMPLATE_STRING_IF_INVALID
else:
try: # method call (assuming no args required)