[PATCH 1/2] Make self.ui available in all Repository() derivatives

Sebastian Spaeth Sebastian at SSpaeth.de
Thu Mar 3 10:43:22 GMT 2011


This enables us to make use of self.ui in all repositories without
having to import and use getglobalui() in all types of repositories and
all places.

Note that this patch only makes this available, it does not yet make use
of it.

Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
 offlineimap/repository/Base.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/offlineimap/repository/Base.py b/offlineimap/repository/Base.py
index 7e1dd4d..10adca4 100644
--- a/offlineimap/repository/Base.py
+++ b/offlineimap/repository/Base.py
@@ -45,6 +45,7 @@ def LoadRepository(name, account, reqtype):
 
 class BaseRepository(CustomConfig.ConfigHelperMixin):
     def __init__(self, reposname, account):
+        self.ui = getglobalui()
         self.account = account
         self.config = account.getconfig()
         self.name = reposname
@@ -166,7 +167,7 @@ class BaseRepository(CustomConfig.ConfigHelperMixin):
                 except (KeyboardInterrupt):
                     raise
                 except:
-                    getglobalui().warn("ERROR Attempting to create folder " \
+                    self.ui.warn("ERROR Attempting to create folder " \
                         + key + ":"  +traceback.format_exc())
 
         #
-- 
1.7.1





More information about the OfflineIMAP-project mailing list