summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-12-19 14:24:32 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-12-19 14:24:32 +0100
commit05e22e2a6a219462164e919aa26541e3a59a177c (patch)
tree89048335d1eddbdb9b0096bc4652ac48773e6bfb /pykolab
parent213609d6676bcb494dd9af468ab3b4e5b5acd245 (diff)
downloadpykolab-05e22e2a6a219462164e919aa26541e3a59a177c.tar.gz
When creating a folder, attempt to create the folder but return false if the folder creation fails
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/imap/__init__.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index 1dcae4d..705e09f 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -202,9 +202,25 @@ class IMAP(object):
if not self._imap.has_key(server):
self.connect(server=server)
- self._imap[server].cm(folder_path)
+ try:
+ self._imap[server].cm(folder_path)
+ return True
+ except:
+ log.error(
+ _("Could not create folder %r") + \
+ _(" on server %r") % (
+ folder_path,
+ server
+ )
+ )
+
else:
- self.imap.cm(folder_path)
+ try:
+ self.imap.cm(folder_path)
+ return True
+ except:
+ log.error(_("Could not create folder %r") % (folder_path))
+ return False
def __getattr__(self, name):
if hasattr(self.imap, name):