premailer: replace logger instead of altering handlers.

Initial logger posted to stderr poluting output and tests
This commit is contained in:
RhodeCode Admin 2023-01-21 14:34:46 +01:00
parent f56bc796ad
commit 59792e6457

View file

@ -330,6 +330,11 @@ EMAIL_COMMENT_STATUS_CHANGE_SUBJECT_TEMPLATE = ''
# Title of email for inline comment on a file in commit
EMAIL_COMMENT_FILE_SUBJECT_TEMPLATE = ''
import cssutils
# hijack css utils logger and replace with ours
log = logging.getLogger('rhodecode.cssutils.premailer')
cssutils.log.setLog(log)
class EmailNotificationModel(BaseModel):
TYPE_COMMIT_COMMENT = Notification.TYPE_CHANGESET_COMMENT
@ -373,11 +378,7 @@ class EmailNotificationModel(BaseModel):
'rhodecode:templates/email_templates/pull_request_update.mako',
}
premailer_instance = premailer.Premailer(
cssutils_logging_level=logging.ERROR,
cssutils_logging_handler=logging.getLogger().handlers[0]
if logging.getLogger().handlers else None,
)
premailer_instance = premailer.Premailer()
def __init__(self):
"""