Skip to content

Commit e02007a

Browse files
committed
Limit AuthServiceProxyWrapper.__getattr__ wrapping
Change AuthServiceProxyWrapper.__getattr__ to only wrap proxied attributes, not real attributes. This way AuthServiceProxyWrapper can continue logging RPC calls without complicating other object usages, and special case handling for the .url property can be dropped.
1 parent edafc71 commit e02007a

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

test/functional/test_framework/coverage.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ def __init__(self, auth_service_proxy_instance, coverage_logfile=None):
3131
self.auth_service_proxy_instance = auth_service_proxy_instance
3232
self.coverage_logfile = coverage_logfile
3333

34-
def __getattr__(self, *args, **kwargs):
35-
return_val = self.auth_service_proxy_instance.__getattr__(
36-
*args, **kwargs)
37-
34+
def __getattr__(self, name):
35+
return_val = getattr(self.auth_service_proxy_instance, name)
36+
if not isinstance(return_val, type(self.auth_service_proxy_instance)):
37+
# If proxy getattr returned an unwrapped value, do the same here.
38+
return return_val
3839
return AuthServiceProxyWrapper(return_val, self.coverage_logfile)
3940

4041
def __call__(self, *args, **kwargs):
@@ -52,10 +53,6 @@ def __call__(self, *args, **kwargs):
5253

5354
return return_val
5455

55-
@property
56-
def url(self):
57-
return self.auth_service_proxy_instance.url
58-
5956
def __truediv__(self, relative_uri):
6057
return AuthServiceProxyWrapper(self.auth_service_proxy_instance / relative_uri)
6158

0 commit comments

Comments
 (0)