From 274ac0574c1989df42322554993dea390d755861 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sun, 25 Feb 2024 21:09:19 +0000 Subject: [PATCH] errormail: adjust flask import --- geocode/error_mail.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/geocode/error_mail.py b/geocode/error_mail.py index a1d627f..b2b6b35 100644 --- a/geocode/error_mail.py +++ b/geocode/error_mail.py @@ -5,7 +5,6 @@ from logging import Formatter from logging.handlers import SMTPHandler import flask -from flask import g, request PROJECT = "geocode" @@ -21,10 +20,10 @@ class MySMTPHandler(SMTPHandler): else f"{PROJECT} error: {record.pathname}:{record.lineno:d}" ) - if qid := getattr(g, "qid", None): + if qid := getattr(flask.g, "qid", None): subject += f" {qid}" - if label := getattr(g, "label", None): + if label := getattr(flask.g, "label", None): subject += f": {label}" return subject @@ -35,7 +34,7 @@ class RequestFormatter(Formatter): def format(self, record: logging.LogRecord) -> str: """Record includes request.""" - record.request = request + record.request = flask.request return super().format(record)