# HG changeset patch # User RhodeCode Admin # Date 2023-01-21 13:34:46 # Node ID 916d130a1c433a6deb952616fb1769984f102489 # Parent d9965ed62e52984edd105b05385a56738ad56f62 premailer: replace logger instead of altering handlers. Initial logger posted to stderr poluting output and tests diff --git a/rhodecode/model/notification.py b/rhodecode/model/notification.py --- a/rhodecode/model/notification.py +++ b/rhodecode/model/notification.py @@ -330,6 +330,11 @@ EMAIL_COMMENT_STATUS_CHANGE_SUBJECT_TEMP # 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): """