summaryrefslogtreecommitdiffstats
path: root/pykolab/imap
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-11-21 14:43:59 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-11-21 14:43:59 +0100
commit6bf3cdc14e8b41e303f5204545c380c8813a30a5 (patch)
tree7daca2f650e0e1b5ae9e88ded89ad47dc18bc74c /pykolab/imap
parent998804c66908f84e5e7b2da4685dd3043b8e8c1c (diff)
downloadpykolab-6bf3cdc14e8b41e303f5204545c380c8813a30a5.tar.gz
Add an option --dry-run to undelete-mailbox cmd
Diffstat (limited to 'pykolab/imap')
-rw-r--r--pykolab/imap/cyrus.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/pykolab/imap/cyrus.py b/pykolab/imap/cyrus.py
index 6034b48..ae90fd6 100644
--- a/pykolab/imap/cyrus.py
+++ b/pykolab/imap/cyrus.py
@@ -18,6 +18,7 @@
#
import cyruslib
+import sys
import time
from urlparse import urlparse
@@ -323,10 +324,16 @@ class Cyrus(cyruslib.CYRUS):
target_server = self.find_mailfolder_server(target_folder)
- if not target_server == self.server:
- self.xfer(undelete_folder,target_server)
+ if hasattr(conf,'dry_run') and not conf.dry_run:
+ if not target_server == self.server:
+ self.xfer(undelete_folder,target_server)
- self.rename(undelete_folder,target_folder)
+ self.rename(undelete_folder,target_folder)
+ else:
+ if not target_server == self.server:
+ print >> sys.stdout, _("Would have transfered %s from %s to %s") % (undelete_folder, self.server, target_server)
+
+ print >> sys.stdout, _("Would have renamed %s to %s") % (undelete_folder, target_folder)
def parse_mailfolder(self, mailfolder):
"""