summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2015-08-14 10:19:00 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2015-08-14 10:19:00 +0200
commit85e77768a6658c9676908b1f360ed2c7347ff4c9 (patch)
tree6c81cbaa84a778c36e85c48b53c4b348fb05fad8 /pykolab
parent7ea7399a6d32f65fe670e8e31b60f22bd2132fd2 (diff)
downloadpykolab-85e77768a6658c9676908b1f360ed2c7347ff4c9.tar.gz
Ensure the connection is alive on the entry points, not the end points
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/imap/__init__.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index 9c087ef..160dad8 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -240,8 +240,6 @@ class IMAP(object):
)
else:
- self.connect()
-
try:
self.imap.cm(folder_path, partition=partition)
return True
@@ -453,6 +451,7 @@ class IMAP(object):
"""
Create a shared folder.
"""
+ self.connect()
folder_name = "shared%s%s" % (self.get_separator(), mailbox_base_name)
@@ -467,6 +466,8 @@ class IMAP(object):
"""
Check if a shared mailbox exists.
"""
+ self.connect()
+
folder_name = "shared%s%s" % (self.get_separator(), mailbox_base_name)
# Correct folder_path being supplied with "shared/shared/" for example
@@ -484,6 +485,8 @@ class IMAP(object):
# TODO: Whether or not to lowercase the mailbox name is really up to the
# IMAP server setting username_tolower (normalize_uid, lmtp_downcase_rcpt).
+ self.connect()
+
if not mailbox_base_name == mailbox_base_name.lower():
log.warning(_("Downcasing mailbox name %r") % (mailbox_base_name))
mailbox_base_name = mailbox_base_name.lower()
@@ -737,6 +740,8 @@ class IMAP(object):
"""
Check if a user mailbox exists.
"""
+ self.connect()
+
if not mailbox_base_name == mailbox_base_name.lower():
log.warning(_("Downcasing mailbox name %r") % (mailbox_base_name))
mailbox_base_name = mailbox_base_name.lower()
@@ -747,6 +752,8 @@ class IMAP(object):
pass
def user_mailbox_rename(self, old_name, new_name, partition=None):
+ self.connect()
+
old_name = "user%s%s" % (self.get_separator(),old_name)
new_name = "user%s%s" % (self.get_separator(),new_name)