This commit is contained in:
Chris Seto 2017-05-20 16:40:24 +00:00 committed by GitHub
commit 71183ce165

View File

@ -369,11 +369,24 @@ class Request(object):
else: else:
self.auth = None self.auth = None
def __getattribute__(self, attr): def __getattr__(self, attr):
""" """
If an attribute does not exist on this instance, then we also attempt If an attribute does not exist on this instance, then we also attempt
to proxy it to the underlying HttpRequest object. to proxy it to the underlying HttpRequest object.
""" """
try:
return getattr(self._request, attr)
except AttributeError:
# Call the original implementation of getattribute
# So the correct attribute error will get raised
self.__getattr_trace__(attr)
def __getattr_trace__(self, attr):
"""
The original implementation of __getattribute__ which
generates correct tracebacks
See #2108 and #2530
"""
try: try:
return super(Request, self).__getattribute__(attr) return super(Request, self).__getattribute__(attr)
except AttributeError: except AttributeError: