Skip to content

Commit

Permalink
Limit AuthServiceProxyWrapper.__getattr__ wrapping
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ryanofsky committed Oct 3, 2017
1 parent edafc71 commit e02007a
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions test/functional/test_framework/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ def __init__(self, auth_service_proxy_instance, coverage_logfile=None):
self.auth_service_proxy_instance = auth_service_proxy_instance
self.coverage_logfile = coverage_logfile

def __getattr__(self, *args, **kwargs):
return_val = self.auth_service_proxy_instance.__getattr__(
*args, **kwargs)

def __getattr__(self, name):
return_val = getattr(self.auth_service_proxy_instance, name)
if not isinstance(return_val, type(self.auth_service_proxy_instance)):
# If proxy getattr returned an unwrapped value, do the same here.
return return_val
return AuthServiceProxyWrapper(return_val, self.coverage_logfile)

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

return return_val

@property
def url(self):
return self.auth_service_proxy_instance.url

def __truediv__(self, relative_uri):
return AuthServiceProxyWrapper(self.auth_service_proxy_instance / relative_uri)

Expand Down

0 comments on commit e02007a

Please sign in to comment.