mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 09:13:23 +00:00
proxy getattr to the real connection too
This commit is contained in:
@@ -334,6 +334,18 @@ class VCRConnection(object):
|
|||||||
|
|
||||||
super(VCRConnection, self).__setattr__(name, value)
|
super(VCRConnection, self).__setattr__(name, value)
|
||||||
|
|
||||||
|
def __getattr__(self, name):
|
||||||
|
"""
|
||||||
|
Send requests for weird attributes up to the real connection
|
||||||
|
(counterpart to __setattr above)
|
||||||
|
"""
|
||||||
|
if self.__dict__.get('real_connection'):
|
||||||
|
# check in case real_connection has not been set yet, such as when
|
||||||
|
# we're setting the real_connection itself for the first time
|
||||||
|
return getattr(self.real_connection, name)
|
||||||
|
|
||||||
|
return super(VCRConnection, self).__getattr__(name)
|
||||||
|
|
||||||
|
|
||||||
for k, v in HTTPConnection.__dict__.items():
|
for k, v in HTTPConnection.__dict__.items():
|
||||||
if isinstance(v, staticmethod):
|
if isinstance(v, staticmethod):
|
||||||
|
|||||||
Reference in New Issue
Block a user