summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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):