Fixed #23489 -- Added numpy 1.9+ support in template lookups

This commit is contained in:
Tim Graham 2014-09-29 19:51:33 -04:00
parent 054bdfeff1
commit 12809e1609
1 changed files with 3 additions and 1 deletions

View File

@ -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):