summaryrefslogtreecommitdiffstats
path: root/pykolab/plugins/defaultfolders
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-03-23 13:19:30 +0000
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-03-23 13:19:30 +0000
commitb2c7f60ec0cf67b6510c8126f31e015d316634cb (patch)
tree2ef54fde25d98a5f73e5eba6dabc64a1e417597a /pykolab/plugins/defaultfolders
parent5e5441ecd228e2fa71d6406ba6a7f1f94422d389 (diff)
downloadpykolab-b2c7f60ec0cf67b6510c8126f31e015d316634cb.tar.gz
The plugins can now make use of the logging facilities,
Have the plugins be passed keywords and reflect that
Diffstat (limited to 'pykolab/plugins/defaultfolders')
-rw-r--r--pykolab/plugins/defaultfolders/__init__.py31
1 files changed, 21 insertions, 10 deletions
diff --git a/pykolab/plugins/defaultfolders/__init__.py b/pykolab/plugins/defaultfolders/__init__.py
index 426b293..91db993 100644
--- a/pykolab/plugins/defaultfolders/__init__.py
+++ b/pykolab/plugins/defaultfolders/__init__.py
@@ -17,28 +17,39 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-__all__ = [
- 'KolabDefaultfolders'
- ]
+import pykolab
+
+from pykolab.translate import _
+
+conf = pykolab.getConf()
+log = pykolab.getLogger('pykolab.plugins.defaultfolders')
class KolabDefaultfolders(object):
"""
Example plugin to create a set of default folders.
"""
- def __init__(self, conf=None):
- self.conf = conf
+ def __init__(self):
+ pass
+
+ def add_options(self, *args, **kw):
+ pass
- def create_user_folders(self, kw={}, args=()):
+ def create_user_folders(self, *args, **kw):
"""
The arguments passed to the 'create_user_folders' hook:
- - imap connection
- - user folder
+ additional_folders - additional folders to create
+ user_folder - user folder
"""
- (folder, additional_folders) = args
+ if not kw.has_key('additional_folders'):
+ return {}
- exec("additional_folders = %s" %(additional_folders))
+ try:
+ exec("additional_folders = %s" %(kw['additional_folders']))
+ except Exception, e:
+ log.error(_("Could not parse additional_folders"))
+ return {}
return additional_folders