From 3cd3edefca21724dddf873ed03eea889eb8ede10 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Wed, 18 Jan 2012 00:39:04 +0100 Subject: [PATCH] TTYUI: Fix python 2.6 compatibility We were using super() on a class derived from logging.Formatter() which worked fine in python 2.7. Apparently python 2.6 uses old-style classes for this, so the TTYUI broke and crashed OfflineImap. This was introduced in OLI 6.5.0, I think. Fix it by calling logging.Formatter.... directly, rather than the elegant super() (which I happen to like a lot more than is appropriate in the python world). Reported by Nik Reiman as github issue 23, should fix that issue. Signed-off-by: Sebastian Spaeth --- Changelog.draft.rst | 2 ++ offlineimap/ui/TTY.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Changelog.draft.rst b/Changelog.draft.rst index 76a0ea3..99c70bc 100644 --- a/Changelog.draft.rst +++ b/Changelog.draft.rst @@ -18,3 +18,5 @@ Changes Bug Fixes --------- + +* Fix python2.6 compatibility with the TTYUI backend (crash) diff --git a/offlineimap/ui/TTY.py b/offlineimap/ui/TTY.py index 2b3e834..862d7a4 100644 --- a/offlineimap/ui/TTY.py +++ b/offlineimap/ui/TTY.py @@ -24,12 +24,14 @@ from offlineimap.ui.UIBase import UIBase class TTYFormatter(logging.Formatter): """Specific Formatter that adds thread information to the log output""" def __init__(self, *args, **kwargs): - super(TTYFormatter, self).__init__(*args, **kwargs) + #super() doesn't work in py2.6 as 'logging' uses old-style class + logging.Formatter.__init__(self, *args, **kwargs) self._last_log_thread = None def format(self, record): """Override format to add thread information""" - log_str = super(TTYFormatter, self).format(record) + #super() doesn't work in py2.6 as 'logging' uses old-style class + log_str = logging.Formatter.format(self, record) # If msg comes from a different thread than our last, prepend # thread info. Most look like 'Account sync foo' or 'Folder # sync foo'.