From bd3766eca54c19c08d426a5e9af9cfa47d196e6a Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Thu, 5 May 2011 15:59:25 +0200 Subject: [PATCH] Make getnicename work again for classes that derive from object() Python's new style classes derive from object and str(class().__class__) will return a slightly different format. class().__class.__name__ will still work for both old and new style classes, so use that instead. Signed-off-by: Sebastian Spaeth Signed-off-by: Nicolas Sebrecht --- offlineimap/ui/UIBase.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/offlineimap/ui/UIBase.py b/offlineimap/ui/UIBase.py index 677d19b..4b0ca32 100644 --- a/offlineimap/ui/UIBase.py +++ b/offlineimap/ui/UIBase.py @@ -142,7 +142,10 @@ class UIBase: raise Exception, "Another OfflineIMAP is running with the same metadatadir; exiting." def getnicename(s, object): - prelimname = str(object.__class__).split('.')[-1] + """Return the type of a repository or Folder as string + + (IMAP, Gmail, Maildir, etc...)""" + prelimname = object.__class__.__name__.split('.')[-1] # Strip off extra stuff. return re.sub('(Folder|Repository)', '', prelimname)