capybara/virtualenv/lib/python2.7/site-packages/jinja2/environment.py
def getitem(self, obj, argument):
        """Get an item or attribute of an object but prefer the item."""
        try:
            return obj[argument]
        except (TypeError, LookupError):
            if isinstance(argument, string_types):
                try:
                    attr = str(argument)
                except Exception:
                    pass
                else:
                    try:
                        return getattr(obj, attr)
                    except AttributeError:
                        pass
            return self.undefined(obj=obj, name=argument)
def getitem(self, obj, argument):
        """Get an item or attribute of an object but prefer the item."""
        try:
            return obj[argument]
        except (TypeError, LookupError):
            if isinstance(argument, string_types):
                try:
                    attr = str(argument)
                except Exception:
                    pass
                else:
                    try:
                        return getattr(obj, attr)
                    except AttributeError:
                        pass
            return self.undefined(obj=obj, name=argument)
def getitem ( self , obj , argument ) : try : return obj [ argument ] except ( TypeError , LookupError ) : if isinstance ( argument , string_types ) : try : attr = str ( argument ) except Exception : pass else : try : return getattr ( obj , attr ) except AttributeError : pass return self . undefined ( obj = obj , name = argument )
Get an item or attribute of an object but prefer the item.
Get an item or attribute of an object but prefer the item .