[PATCH 5/9] Make getnicename work again for classes that derive from object()
Sebastian Spaeth
Sebastian at SSpaeth.de
Tue Apr 26 11:31:36 BST 2011
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 <Sebastian at SSpaeth.de>
---
offlineimap/ui/UIBase.py | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/offlineimap/ui/UIBase.py b/offlineimap/ui/UIBase.py
index 02593e6..e81506b 100644
--- a/offlineimap/ui/UIBase.py
+++ b/offlineimap/ui/UIBase.py
@@ -136,7 +136,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)
--
1.7.4.1
More information about the OfflineIMAP-project
mailing list