Ticket #16383: _resolve_lookup.patch

File _resolve_lookup.patch, 954 bytes (added by maraujop, 4 years ago)
  • django/template/base.py

    diff --git a/django/template/base.py b/django/template/base.py
    index b96e446..809ac06 100644
    a b class Variable(object): 
    682682                except (TypeError, AttributeError, KeyError):
    683683                    try: # attribute lookup
    684684                        current = getattr(current, bit)
    685                     except (TypeError, AttributeError):
     685                    except (TypeError, AttributeError), error:
     686                        if hasattr(current, "__class__"):   # method/property has code errors within
     687                            if hasattr(current.__class__, bit):
     688                                raise VariableDoesNotExist("Failed lookup for key [%s] in %r \n %s", (bit, current, error))
    686689                        try: # list-index lookup
    687690                            current = current[int(bit)]
    688691                        except (IndexError, # list index out of range
Back to Top