This is an automated email from the ASF dual-hosted git repository. dill0wn pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/allura.git
commit 81d9f05aa5010fb57503caa9d750c9a6dec46781 Author: Dave Brondsema <[email protected]> AuthorDate: Thu Dec 31 16:55:21 2020 -0500 [#8382] py3: avoid error if global 'c' isn't set yet --- Allura/allura/lib/custom_middleware.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Allura/allura/lib/custom_middleware.py b/Allura/allura/lib/custom_middleware.py index b38b0b9..bf6ce72 100644 --- a/Allura/allura/lib/custom_middleware.py +++ b/Allura/allura/lib/custom_middleware.py @@ -387,8 +387,12 @@ class AlluraTimerMiddleware(TimerMiddleware): return timers def before_logging(self, stat_record): - if hasattr(c, "app") and hasattr(c.app, "config"): - stat_record.add('request_category', c.app.config.tool_name.lower()) + try: + app_config = c.app.config + except (TypeError, AttributeError): + pass + else: + stat_record.add('request_category', app_config.tool_name.lower()) return stat_record @classmethod
