diff options
author | Alassane Yattara <alassane.yattara@savoirfairelinux.com> | 2023-10-17 21:32:05 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-10-23 11:39:38 +0100 |
commit | 307f40fc83a0e3d530bf934ef4aefd8e15cf27de (patch) | |
tree | 79273247abf642855767cc2667229f8b4eaaffcc | |
parent | 315f48f965a54da5cec92908d91aa61c2d450add (diff) | |
download | bitbake-contrib-307f40fc83a0e3d530bf934ef4aefd8e15cf27de.tar.gz |
Toaster: bug-fix on /toastermain/logs.py
- Update /toastermain/logs.py to fix:
AttributeError: 'NoneType' object has no attribute 'view_name'
Signed-off-by Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | lib/toaster/toastermain/logs.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/toaster/toastermain/logs.py b/lib/toaster/toastermain/logs.py index f9953982b..b4910e443 100644 --- a/lib/toaster/toastermain/logs.py +++ b/lib/toaster/toastermain/logs.py @@ -38,8 +38,13 @@ def log_view_mixin(view): request = kwargs.get('request') response = view(*args, **kwargs) + view_name = 'unknown' + if hasattr(request, 'resolver_match'): + if hasattr(request.resolver_match, 'view_name'): + view_name = request.resolver_match.view_name + log_api_request( - request, response, request.resolver_match.view_name, 'toaster') + request, response, view_name, 'toaster') return response return log_view_request |