summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-07-05 15:33:25 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-07-05 15:33:25 +0100
commit6e0cace0773528ab41dd9559e69b0b46e666ada6 (patch)
treea7409a33810ace8da6c5645b4486e7cdaa982524 /pykolab
parent5730afec6a3d17b77676d59295cb275d5c4d9c02 (diff)
downloadpykolab-6e0cace0773528ab41dd9559e69b0b46e666ada6.tar.gz
Add an additional boolean to the call to connect to imap, whether or not to login
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/imap/__init__.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index 03a87ae..2b59a4b 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -44,7 +44,7 @@ class IMAP(object):
self.users = []
self.inbox_folders = []
- def connect(self, uri=None):
+ def connect(self, uri=None, login=True):
backend = conf.get('kolab', 'imap_backend')
if uri == None:
@@ -61,22 +61,25 @@ class IMAP(object):
import cyrus
self._imap[result.hostname] = cyrus.Cyrus(uri)
# Actually connect
- log.debug(_("Logging on to Cyrus IMAP server %s") %(result.hostname), level=8)
- self._imap[result.hostname].login(admin_login, admin_password)
+ if login:
+ log.debug(_("Logging on to Cyrus IMAP server %s") %(result.hostname), level=8)
+ self._imap[result.hostname].login(admin_login, admin_password)
elif backend == 'dovecot':
import dovecot
self._imap[result.hostname] = dovecot.Dovecot(uri)
# Actually connect
- log.debug(_("Logging on to Dovecot IMAP server %s") %(result.hostname), level=8)
- self._imap[result.hostname].login(admin_login, admin_password)
+ if login:
+ log.debug(_("Logging on to Dovecot IMAP server %s") %(result.hostname), level=8)
+ self._imap[result.hostname].login(admin_login, admin_password)
else:
import imap
self._imap[result.hostname] = imap.IMAP(uri)
# Actually connect
- log.debug(_("Logging on to generic IMAP server %s") %(result.hostname), level=8)
- self._imap[result.hostname].login(admin_login, admin_password)
+ if login:
+ log.debug(_("Logging on to generic IMAP server %s") %(result.hostname), level=8)
+ self._imap[result.hostname].login(admin_login, admin_password)
else:
log.debug(_("Reusing existing IMAP server connection to %s") %(result.hostname), level=8)