[PATCH 5/5] Remove visiblename as parameter to IMAPFolder creation

Sebastian Spaeth Sebastian at SSpaeth.de
Thu Sep 15 16:55:39 BST 2011


IMAPFolder has the repository and foldername values so it can get the
transposed (aka visiblename) of a folder itself just fine. There is no
need to pass it in as an separate parameter.

Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
 offlineimap/folder/Gmail.py    |    5 ++---
 offlineimap/folder/IMAP.py     |    4 ++--
 offlineimap/repository/IMAP.py |    6 +-----
 3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/offlineimap/folder/Gmail.py b/offlineimap/folder/Gmail.py
index dc301d0..8d9c0bc 100644
--- a/offlineimap/folder/Gmail.py
+++ b/offlineimap/folder/Gmail.py
@@ -33,9 +33,8 @@ class GmailFolder(IMAPFolder):
       http://mail.google.com/support/bin/answer.py?answer=77657&topic=12815
     """
 
-    def __init__(self, imapserver, name, visiblename, repository):
-        super(GmailFolder, self).__init__(imapserver, name, visiblename,
-                                          repository)
+    def __init__(self, imapserver, name, repository):
+        super(GmailFolder, self).__init__(imapserver, name, repository)
         self.realdelete = repository.getrealdelete(name)
         self.trash_folder = repository.gettrashfolder(name)
         #: Gmail will really delete messages upon EXPUNGE in these folders
diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py
index 822ab7c..b23d34c 100644
--- a/offlineimap/folder/IMAP.py
+++ b/offlineimap/folder/IMAP.py
@@ -32,7 +32,7 @@ except NameError:
 
 
 class IMAPFolder(BaseFolder):
-    def __init__(self, imapserver, name, visiblename, repository):
+    def __init__(self, imapserver, name, repository):
         name = imaputil.dequote(name)
         super(IMAPFolder, self).__init__(name, repository)
         self.expunge = repository.getexpunge()
@@ -40,7 +40,7 @@ class IMAPFolder(BaseFolder):
         self.sep = imapserver.delim
         self.imapserver = imapserver
         self.messagelist = None
-        self.visiblename = visiblename
+        self.visiblename = repository.nametrans(name)
         self.randomgenerator = random.Random()
         #self.ui is set in BaseFolder
 
diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py
index 2b0ca8f..64e85f9 100644
--- a/offlineimap/repository/IMAP.py
+++ b/offlineimap/repository/IMAP.py
@@ -259,9 +259,7 @@ class IMAPRepository(BaseRepository):
 
 
     def getfolder(self, foldername):
-        return self.getfoldertype()(self.imapserver, foldername,
-                                    self.nametrans(foldername),
-                                    self)
+        return self.getfoldertype()(self.imapserver, foldername, self)
 
     def getfoldertype(self):
         return folder.IMAP.IMAPFolder
@@ -303,7 +301,6 @@ class IMAPRepository(BaseRepository):
                                   foldername)
                 continue
             retval.append(self.getfoldertype()(self.imapserver, foldername,
-                                               self.nametrans(foldername),
                                                self))
         if len(self.folderincludes):
             imapobj = self.imapserver.acquireconnection()
@@ -320,7 +317,6 @@ class IMAPRepository(BaseRepository):
                         continue
                     retval.append(self.getfoldertype()(self.imapserver,
                                                        foldername,
-                                                       self.nametrans(foldername),
                                                        self))
             finally:
                 self.imapserver.releaseconnection(imapobj)
-- 
1.7.4.1





More information about the OfflineIMAP-project mailing list