summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2014-09-29 19:51:33 -0400
committerTim Graham <timograham@gmail.com>2014-09-29 19:51:39 -0400
commit12809e160995eb617fe394c75e5b9f3211c056ff (patch)
tree4e25c12cc0c76e0f56513e8ffdfb8724b9493028
parent054bdfeff113459a48974d08098915431d0a093d (diff)
Fixed #23489 -- Added numpy 1.9+ support in template lookups
-rw-r--r--django/template/base.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/template/base.py b/django/template/base.py
index b6083677e6..ee33dacda2 100644
--- a/django/template/base.py
+++ b/django/template/base.py
@@ -767,7 +767,9 @@ class Variable(object):
for bit in self.lookups:
try: # dictionary lookup
current = current[bit]
- except (TypeError, AttributeError, KeyError, ValueError):
+ # ValueError/IndexError are for numpy.array lookup on
+ # numpy < 1.9 and 1.9+ respectively
+ except (TypeError, AttributeError, KeyError, ValueError, IndexError):
try: # attribute lookup
# Don't return class attributes if the class is the context:
if isinstance(current, BaseContext) and getattr(type(current), bit):