From 12809e160995eb617fe394c75e5b9f3211c056ff Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Mon, 29 Sep 2014 19:51:33 -0400 Subject: [PATCH] Fixed #23489 -- Added numpy 1.9+ support in template lookups --- django/template/base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/django/template/base.py b/django/template/base.py index b6083677e63..ee33dacda22 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):