From cf1a887b23c02bca0447d12374af878487213e6c Mon Sep 17 00:00:00 2001 From: anthony sottile <103459774+asottile-sentry@users.noreply.github.com> Date: Fri, 25 Oct 2024 13:47:16 -0400 Subject: [PATCH] ref: fix types for middleware.acesss_log (#79755) --- pyproject.toml | 1 - src/sentry/middleware/access_log.py | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 23cf26b13bad65..ed0c3546997fdd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -272,7 +272,6 @@ module = [ "sentry.integrations.vsts.repository", "sentry.integrations.vsts_extension.integration", "sentry.issues.search", - "sentry.middleware.access_log", "sentry.middleware.auth", "sentry.middleware.ratelimit", "sentry.middleware.superuser", diff --git a/src/sentry/middleware/access_log.py b/src/sentry/middleware/access_log.py index 5b1ff99e0a0ccc..0fc0d2cb241da7 100644 --- a/src/sentry/middleware/access_log.py +++ b/src/sentry/middleware/access_log.py @@ -76,10 +76,10 @@ def _create_api_access_log( Create a log entry to be used for api metrics gathering """ try: - try: - view = request.resolver_match._func_path - except AttributeError: + if request.resolver_match is None: view = "Unknown" + else: + view = request.resolver_match._func_path request_auth = _get_request_auth(request) token_type = str(_get_token_name(request_auth))