fixed scope test attr error for older_requirements.txt test

This commit is contained in:
IvanaH8
2020-12-09 14:50:50 +01:00
parent f9a3eec147
commit 9de9070641
2 changed files with 8 additions and 2 deletions

View File

@@ -406,9 +406,15 @@ def needs_scope(scope):
if check_scope(self, scope, parsed_scopes, **s_kwargs): if check_scope(self, scope, parsed_scopes, **s_kwargs):
return func(self, *args, **kwargs) return func(self, *args, **kwargs)
else: else:
# catching attr error occurring for older_requirements test
# could be done more ellegantly?
try:
request_path = self.request.path
except AttributeError:
request_path = 'the requested API'
app_log.warning( app_log.warning(
"Not authorizing access to {}. Requires scope {}, not derived from scopes {}".format( "Not authorizing access to {}. Requires scope {}, not derived from scopes {}".format(
self.request.path, scope, ", ".join(self.scopes) request_path, scope, ", ".join(self.scopes)
) )
) )
raise web.HTTPError( raise web.HTTPError(