pykolab/imap

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Thu Dec 11 17:57:31 CET 2014


 pykolab/imap/__init__.py |   20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

New commits:
commit af36c305dad7016ef02a64699f78704e8ce638b3
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu Dec 11 17:57:14 2014 +0100

    Fix a parse error in creating additional folders for user mailboxes

diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index cf6ff07..4acc58f 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -554,9 +554,9 @@ class IMAP(object):
 
         return folder_name
 
-    def user_mailbox_create_additional_folders(self, folder, additional_folders):
+    def user_mailbox_create_additional_folders(self, user, additional_folders):
         log.debug(
-                _("Creating additional folders for user %s") % (folder),
+                _("Creating additional folders for user %s") % (user),
                 level=8
             )
 
@@ -565,6 +565,8 @@ class IMAP(object):
         admin_login = conf.get(backend, 'admin_login')
         admin_password = conf.get(backend, 'admin_password')
 
+        folder = 'user%s%s' % (self.get_separator(), user)
+
         if self.imap_murder():
             server = self.user_mailbox_server(folder)
         else:
@@ -577,7 +579,7 @@ class IMAP(object):
 
                 self.disconnect()
                 self.connect(login=False, server=server)
-                self.login_plain(admin_login, admin_password, folder)
+                self.login_plain(admin_login, admin_password, user)
                 (personal, other, shared) = self.namespaces()
                 success = True
             except Exception, errmsg:
@@ -635,12 +637,12 @@ class IMAP(object):
                             "%s" % (additional_folders[additional_folder]["acls"][acl])
                         )
 
-        if len(folder.split('@')) > 1:
-            localpart = folder.split('@')[0]
-            domain = folder.split('@')[1]
+        if len(user.split('@')) > 1:
+            localpart = user.split('@')[0]
+            domain = user.split('@')[1]
             domain_suffix = "@%s" % (domain)
         else:
-            localpart = folder
+            localpart = user
             domain = None
             domain_suffix = ""
 
@@ -684,11 +686,11 @@ class IMAP(object):
                     _subscribe = False
 
             if _subscribe:
-                log.debug(_("Subscribing %s to folder %s") % (folder, _folder), level=8)
+                log.debug(_("Subscribing %s to folder %s") % (user, _folder), level=8)
                 try:
                     self.subscribe(_folder)
                 except Exception, errmsg:
-                    log.error(_("Subscribing %s to folder %s failed: %r") % (folder, _folder, errmsg))
+                    log.error(_("Subscribing %s to folder %s failed: %r") % (user, _folder, errmsg))
 
         self.logout()
         self.connect(domain=self.domain)




More information about the commits mailing list