Branch 'pykolab-0.5' - 4 commits - configure.ac pykolab/imap

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Fri Jan 17 14:00:40 CET 2014


 configure.ac             |    2 +-
 pykolab/imap/__init__.py |   44 +++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 40 insertions(+), 6 deletions(-)

New commits:
commit 736af33d57b950207ba4e1d591b6b34df5d2be9a
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Fri Jan 17 14:00:21 2014 +0100

    Bump release for three additional bug-fixes

diff --git a/configure.ac b/configure.ac
index 16201b3..386cfc7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_INIT([pykolab], 0.5.17)
-AC_SUBST([RELEASE], 2)
+AC_SUBST([RELEASE], 3)
 
 AC_CONFIG_SRCDIR(pykolab/constants.py.in)
 


commit d377874c27b7cddb8c9f617b8b5c5352d43ae71d
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Fri Nov 30 12:03:11 2012 +0000

    Reconnect if setting quota fails

diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index 046fdbd..a5f5f11 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -663,7 +663,15 @@ class IMAP(object):
                 log.debug(_("Value for user is not a dictionary"), level=8)
 
     def set_quota(self, folder, quota):
-        self.imap._setquota(folder, quota)
+        i = 0
+        while i < 10:
+            try:
+                self.imap._setquota(folder, quota)
+                i = 10
+            except:
+                self.disconnect()
+                self.connect()
+                i += 1
 
     def set_user_folder_quota(self, users=[], primary_domain=None, secondary_domain=[], folders=[]):
         """


commit e8e33406d0bb0373fdbfb31f1e14a8dc93490059
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Fri Jan 17 13:58:27 2014 +0100

    Await having created the user mailbox in a cyrus imap murder topology

diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index e540bc0..046fdbd 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -385,6 +385,18 @@ class IMAP(object):
 
         self.create_folder(folder_name, server)
 
+        # In a Cyrus IMAP Murder topology, wait for the murder to have settled
+        if hasattr(self.imap, 'murder') and self.imap.murder:
+            self.disconnect()
+            self.connect()
+
+        created = False
+        while not created:
+            created = self.has_folder(folder_name)
+            if not created:
+                log.info(_("Waiting for the Cyrus IMAP Murder to settle..."))
+                time.sleep(0.5)
+
         if not self.domain == None:
             if conf.has_option(self.domain, "autocreate_folders"):
                     _additional_folders = conf.get_raw(


commit 95e0c4347e93dc1730c43a4732cdfbfcf1165cc4
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Jun 12 07:02:16 2013 +0200

    When connecting to a specific server, actually connect to that specific server
    Calling disconnect() should not traceback should no current connection exist
    self.namespaces() may not be successful as the user to login as has no mailbox yet (murder)
    
    Conflicts:
    	pykolab/imap/__init__.py

diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index 1bd1f77..e540bc0 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -171,7 +171,7 @@ class IMAP(object):
                     self._imap[hostname].logged_in = True
 
         else:
-            if not login and self._imap[hostname].logged_in == True:
+            if not login:
                 self.disconnect(hostname)
                 self.connect(uri=uri,login=False)
             elif login and not hasattr(self._imap[hostname],'logged_in'):
@@ -197,7 +197,8 @@ class IMAP(object):
     def disconnect(self, server=None):
         if server == None:
             # No server specified, but make sure self.imap is None anyways
-            del self.imap
+            if hasattr(self, 'imap'):
+                del self.imap
         else:
             if self._imap.has_key(server):
                 del self._imap[server]
@@ -418,8 +419,21 @@ class IMAP(object):
         admin_login = conf.get(backend, 'admin_login')
         admin_password = conf.get(backend, 'admin_password')
 
-        self.connect(login=False)
-        self.login_plain(admin_login, admin_password, folder)
+        success = False
+        while not success:
+            try:
+
+                self.disconnect()
+                self.connect(login=False)
+                self.login_plain(admin_login, admin_password, folder)
+                (personal, other, shared) = self.namespaces()
+                success = True
+            except Exception, errmsg:
+                log.debug(_("Waiting for the Cyrus murder to settle... %r") % (errmsg))
+                if conf.debuglevel > 8:
+                    import traceback
+                    traceback.print_exc()
+                time.sleep(0.5)
 
         for additional_folder in additional_folders.keys():
             _add_folder = {}




More information about the commits mailing list