summaryrefslogtreecommitdiffstats
path: root/pykolab/cli
diff options
context:
space:
mode:
authorChristoph Erhardt <kolab@sicherha.de>2021-06-04 16:53:52 +0200
committerChristoph Erhardt <kolab@sicherha.de>2022-01-10 20:46:43 +0100
commit991255eaa314b51e2dd586460311d4633a56eb86 (patch)
treee3e711046511d69fabdac2c67e66df4834a1e763 /pykolab/cli
parentd0579b7e5da331576b80b9d35eb62994075bc939 (diff)
downloadpykolab-991255eaa314b51e2dd586460311d4633a56eb86.tar.gz
[Python 3] Use new exception syntax
Summary: The new syntax was introduced in Python 2.6; the old syntax was deprecated in Python 3.0. Reviewers: machniak, mollekopf Reviewed By: mollekopf Differential Revision: https://git.kolab.org/D3232
Diffstat (limited to 'pykolab/cli')
-rw-r--r--pykolab/cli/cmd_add_domain.py2
-rw-r--r--pykolab/cli/cmd_add_user_subscription.py4
-rw-r--r--pykolab/cli/cmd_create_mailbox.py2
-rw-r--r--pykolab/cli/cmd_delete_domain.py2
-rw-r--r--pykolab/cli/cmd_delete_mailbox.py2
-rw-r--r--pykolab/cli/cmd_delete_mailbox_acl.py4
-rw-r--r--pykolab/cli/cmd_find_domain.py2
-rw-r--r--pykolab/cli/cmd_list_mailbox_acls.py2
-rw-r--r--pykolab/cli/cmd_list_mailbox_metadata.py2
-rw-r--r--pykolab/cli/cmd_list_quota.py2
-rw-r--r--pykolab/cli/cmd_list_user_subscriptions.py4
-rw-r--r--pykolab/cli/cmd_remove_mailaddress.py2
-rw-r--r--pykolab/cli/cmd_remove_user_subscription.py4
-rw-r--r--pykolab/cli/cmd_rename_mailbox.py6
-rw-r--r--pykolab/cli/cmd_set_mailbox_acl.py6
-rw-r--r--pykolab/cli/cmd_set_mailbox_metadata.py6
-rw-r--r--pykolab/cli/cmd_set_quota.py4
-rw-r--r--pykolab/cli/cmd_sync_mailhost_attrs.py4
-rw-r--r--pykolab/cli/cmd_user_info.py2
-rw-r--r--pykolab/cli/commands.py6
20 files changed, 34 insertions, 34 deletions
diff --git a/pykolab/cli/cmd_add_domain.py b/pykolab/cli/cmd_add_domain.py
index a95373e..fecd82a 100644
--- a/pykolab/cli/cmd_add_domain.py
+++ b/pykolab/cli/cmd_add_domain.py
@@ -63,7 +63,7 @@ def execute(*args, **kw):
try:
domain = conf.cli_args.pop(0)
- except IndexError, errmsg:
+ except IndexError:
domain = utils.ask_question(_("Domain name"))
wap_client.domain_add(domain, conf.domains)
diff --git a/pykolab/cli/cmd_add_user_subscription.py b/pykolab/cli/cmd_add_user_subscription.py
index eb0ec40..06ac0e2 100644
--- a/pykolab/cli/cmd_add_user_subscription.py
+++ b/pykolab/cli/cmd_add_user_subscription.py
@@ -50,10 +50,10 @@ def execute(*args, **kw):
user = conf.cli_args.pop(0)
try:
folder_pattern = conf.cli_args.pop(0)
- except IndexError, errmsg:
+ except IndexError:
folder_pattern = utils.ask_question(_("Folder pattern"))
- except IndexError, errmsg:
+ except IndexError:
user = utils.ask_question(_("User ID"))
folder_pattern = utils.ask_question(_("Folder pattern"))
diff --git a/pykolab/cli/cmd_create_mailbox.py b/pykolab/cli/cmd_create_mailbox.py
index 385cbd1..9e91800 100644
--- a/pykolab/cli/cmd_create_mailbox.py
+++ b/pykolab/cli/cmd_create_mailbox.py
@@ -56,7 +56,7 @@ def description():
def execute(*args, **kw):
try:
mailbox = conf.cli_args.pop(0)
- except IndexError, errmsg:
+ except IndexError:
log.error(_("Invalid argument"))
sys.exit(1)
diff --git a/pykolab/cli/cmd_delete_domain.py b/pykolab/cli/cmd_delete_domain.py
index 94418c1..60ca55b 100644
--- a/pykolab/cli/cmd_delete_domain.py
+++ b/pykolab/cli/cmd_delete_domain.py
@@ -63,7 +63,7 @@ def execute(*args, **kw):
try:
domain = conf.cli_args.pop(0)
- except IndexError, errmsg:
+ except IndexError:
domain = utils.ask_question(_("Domain name"))
if wap_client.domain_delete(domain, conf.force):
diff --git a/pykolab/cli/cmd_delete_mailbox.py b/pykolab/cli/cmd_delete_mailbox.py
index f6ff254..40f8b44 100644
--- a/pykolab/cli/cmd_delete_mailbox.py
+++ b/pykolab/cli/cmd_delete_mailbox.py
@@ -67,6 +67,6 @@ def execute(*args, **kw):
for delete_folder in delete_folders:
try:
imap.delete_mailfolder(delete_folder)
- except Exception, errmsg:
+ except Exception:
log.error(_("Could not delete mailbox '%s'") % (delete_folder))
diff --git a/pykolab/cli/cmd_delete_mailbox_acl.py b/pykolab/cli/cmd_delete_mailbox_acl.py
index ebfc2ec..d146aac 100644
--- a/pykolab/cli/cmd_delete_mailbox_acl.py
+++ b/pykolab/cli/cmd_delete_mailbox_acl.py
@@ -43,10 +43,10 @@ def execute(*args, **kw):
folder = conf.cli_args.pop(0)
try:
identifier = conf.cli_args.pop(0)
- except IndexError, errmsg:
+ except IndexError:
identifier = utils.ask_question(_("ACI Subject"))
- except IndexError, errmsg:
+ except IndexError:
folder = utils.ask_question(_("Folder name"))
quota = utils.ask_question(_("ACI Subject"))
diff --git a/pykolab/cli/cmd_find_domain.py b/pykolab/cli/cmd_find_domain.py
index a573634..f65af3f 100644
--- a/pykolab/cli/cmd_find_domain.py
+++ b/pykolab/cli/cmd_find_domain.py
@@ -52,7 +52,7 @@ def execute(*args, **kw):
try:
domain = conf.cli_args.pop(0)
- except IndexError, errmsg:
+ except IndexError:
domain = utils.ask_question(_("Domain name"))
wap_client.domain_find(domain)
diff --git a/pykolab/cli/cmd_list_mailbox_acls.py b/pykolab/cli/cmd_list_mailbox_acls.py
index bf93429..8f14ee6 100644
--- a/pykolab/cli/cmd_list_mailbox_acls.py
+++ b/pykolab/cli/cmd_list_mailbox_acls.py
@@ -41,7 +41,7 @@ def description():
def execute(*args, **kw):
try:
folder = conf.cli_args.pop(0)
- except IndexError, errmsg:
+ except IndexError:
folder = utils.ask_question(_("Folder name"))
if len(folder.split('@')) > 1:
diff --git a/pykolab/cli/cmd_list_mailbox_metadata.py b/pykolab/cli/cmd_list_mailbox_metadata.py
index 718c376..7121723 100644
--- a/pykolab/cli/cmd_list_mailbox_metadata.py
+++ b/pykolab/cli/cmd_list_mailbox_metadata.py
@@ -52,7 +52,7 @@ def description():
def execute(*args, **kw):
try:
folder = conf.cli_args.pop(0)
- except IndexError, errmsg:
+ except IndexError:
folder = utils.ask_question(_("Folder name"))
if len(folder.split('@')) > 1:
diff --git a/pykolab/cli/cmd_list_quota.py b/pykolab/cli/cmd_list_quota.py
index 28b0cd5..d956168 100644
--- a/pykolab/cli/cmd_list_quota.py
+++ b/pykolab/cli/cmd_list_quota.py
@@ -53,7 +53,7 @@ def execute(*args, **kw):
try:
quota_folder = conf.cli_args.pop(0)
- except IndexError, e:
+ except IndexError:
quota_folder = '*'
imap = IMAP()
diff --git a/pykolab/cli/cmd_list_user_subscriptions.py b/pykolab/cli/cmd_list_user_subscriptions.py
index 2d8e4f3..ad6e549 100644
--- a/pykolab/cli/cmd_list_user_subscriptions.py
+++ b/pykolab/cli/cmd_list_user_subscriptions.py
@@ -56,10 +56,10 @@ def execute(*args, **kw):
user = conf.cli_args.pop(0)
try:
folder_pattern = conf.cli_args.pop(0)
- except IndexError, errmsg:
+ except IndexError:
pass
- except IndexError, errmsg:
+ except IndexError:
user = utils.ask_question(_("User ID"))
if len(user.split('@')) > 1:
diff --git a/pykolab/cli/cmd_remove_mailaddress.py b/pykolab/cli/cmd_remove_mailaddress.py
index bc94bb1..c3e5669 100644
--- a/pykolab/cli/cmd_remove_mailaddress.py
+++ b/pykolab/cli/cmd_remove_mailaddress.py
@@ -41,7 +41,7 @@ def description():
def execute(*args, **kw):
try:
email_address = conf.cli_args.pop(0)
- except IndexError, errmsg:
+ except IndexError:
email_address = utils.ask_question("Email address to remove")
# Get the domain from the email address
diff --git a/pykolab/cli/cmd_remove_user_subscription.py b/pykolab/cli/cmd_remove_user_subscription.py
index 343ee68..b16249c 100644
--- a/pykolab/cli/cmd_remove_user_subscription.py
+++ b/pykolab/cli/cmd_remove_user_subscription.py
@@ -50,10 +50,10 @@ def execute(*args, **kw):
user = conf.cli_args.pop(0)
try:
folder_pattern = conf.cli_args.pop(0)
- except IndexError, errmsg:
+ except IndexError:
folder_pattern = utils.ask_question(_("Folder pattern"))
- except IndexError, errmsg:
+ except IndexError:
user = utils.ask_question(_("User ID"))
folder_pattern = utils.ask_question(_("Folder pattern"))
diff --git a/pykolab/cli/cmd_rename_mailbox.py b/pykolab/cli/cmd_rename_mailbox.py
index c693211..4373acf 100644
--- a/pykolab/cli/cmd_rename_mailbox.py
+++ b/pykolab/cli/cmd_rename_mailbox.py
@@ -48,11 +48,11 @@ def execute(*args, **kw):
target_folder = conf.cli_args.pop(0)
try:
partition = conf.cli_args.pop(0)
- except IndexError, errmsg:
+ except IndexError:
partition = None
- except IndexError, errmsg:
+ except IndexError:
print(_("No target mailbox name specified"), file=sys.stderr)
- except IndexError, errmsg:
+ except IndexError:
print(_("No source mailbox name specified"), file=sys.stderr)
sys.exit(1)
diff --git a/pykolab/cli/cmd_set_mailbox_acl.py b/pykolab/cli/cmd_set_mailbox_acl.py
index 249c1ee..63b5c2d 100644
--- a/pykolab/cli/cmd_set_mailbox_acl.py
+++ b/pykolab/cli/cmd_set_mailbox_acl.py
@@ -45,14 +45,14 @@ def execute(*args, **kw):
identifier = conf.cli_args.pop(0)
try:
acl = conf.cli_args.pop(0)
- except IndexError, errmsg:
+ except IndexError:
acl = utils.ask_question(_("ACI Permissions"))
- except IndexError, errmsg:
+ except IndexError:
identifier = utils.ask_question(_("ACI Subject"))
acl = utils.ask_question(_("ACI Permissions"))
- except IndexError, errmsg:
+ except IndexError:
folder = utils.ask_question(_("Folder name"))
identifier = utils.ask_question(_("ACI Subject"))
acl = utils.ask_question(_("ACI Permissions"))
diff --git a/pykolab/cli/cmd_set_mailbox_metadata.py b/pykolab/cli/cmd_set_mailbox_metadata.py
index d63e6a6..91aec50 100644
--- a/pykolab/cli/cmd_set_mailbox_metadata.py
+++ b/pykolab/cli/cmd_set_mailbox_metadata.py
@@ -57,14 +57,14 @@ def execute(*args, **kw):
metadata_path = conf.cli_args.pop(0)
try:
metadata_value = conf.cli_args.pop(0)
- except IndexError, errmsg:
+ except IndexError:
metadata_value = utils.ask_question(_("Metadata value"))
- except IndexError, errmsg:
+ except IndexError:
metadata_path = utils.ask_question(_("Metadata path"))
metadata_value = utils.ask_question(_("Metadata value"))
- except IndexError, errmsg:
+ except IndexError:
folder = utils.ask_question(_("Folder name"))
metadata_path = utils.ask_question(_("Metadata path"))
metadata_value = utils.ask_question(_("Metadata value"))
diff --git a/pykolab/cli/cmd_set_quota.py b/pykolab/cli/cmd_set_quota.py
index 5b7b249..b6c89c1 100644
--- a/pykolab/cli/cmd_set_quota.py
+++ b/pykolab/cli/cmd_set_quota.py
@@ -43,10 +43,10 @@ def execute(*args, **kw):
folder = conf.cli_args.pop(0)
try:
quota = conf.cli_args.pop(0)
- except IndexError, errmsg:
+ except IndexError:
quota = utils.ask_question(_("New quota"))
- except IndexError, errmsg:
+ except IndexError:
folder = utils.ask_question(_("Folder name"))
quota = utils.ask_question(_("New quota"))
diff --git a/pykolab/cli/cmd_sync_mailhost_attrs.py b/pykolab/cli/cmd_sync_mailhost_attrs.py
index 512265b..7b70a77 100644
--- a/pykolab/cli/cmd_sync_mailhost_attrs.py
+++ b/pykolab/cli/cmd_sync_mailhost_attrs.py
@@ -113,7 +113,7 @@ def execute(*args, **kw):
log.info(_("Deleting mailbox '%s' because it has no recipients") % (folder))
try:
imap.dm(folder)
- except Exception, errmsg:
+ except Exception as errmsg:
log.error(_("An error occurred removing mailbox %r: %r") % (folder, errmsg))
else:
log.info(_("Not automatically deleting shared folder '%s'") % (folder))
@@ -161,7 +161,7 @@ def execute(*args, **kw):
log.info(_("Deleting mailbox '%s' because it has no recipients") % (folder))
try:
imap.dm(folder)
- except Exception, errmsg:
+ except Exception as errmsg:
log.error(_("An error occurred removing mailbox %r: %r") % (folder, errmsg))
else:
log.info(_("Not automatically deleting shared folder '%s'") % (folder))
diff --git a/pykolab/cli/cmd_user_info.py b/pykolab/cli/cmd_user_info.py
index a7879d1..e8a5766 100644
--- a/pykolab/cli/cmd_user_info.py
+++ b/pykolab/cli/cmd_user_info.py
@@ -39,7 +39,7 @@ def execute(*args, **kw):
try:
user = conf.cli_args.pop(0)
- except IndexError, errmsg:
+ except IndexError:
user = utils.ask_question(_("Email address"))
result = wap_client.authenticate(username=conf.get("ldap", "bind_dn"), password=conf.get("ldap", "bind_pw"))
diff --git a/pykolab/cli/commands.py b/pykolab/cli/commands.py
index 2f05bb6..196fa93 100644
--- a/pykolab/cli/commands.py
+++ b/pykolab/cli/commands.py
@@ -45,7 +45,7 @@ def __init__():
#print "exec(\"from %s import __init__ as %s_register\"" % (module_name,cmd_name)
try:
exec("from %s import __init__ as %s_register" % (module_name,cmd_name))
- except ImportError, errmsg:
+ except ImportError:
pass
exec("%s_register()" % (cmd_name))
@@ -123,7 +123,7 @@ def execute(cmd_name, *args, **kw):
try:
exec("from %s.cmd_%s import cli_options as %s_%s_cli_options" % (group,command_name,group,command_name))
exec("%s_%s_cli_options()" % (group,command_name))
- except ImportError, e:
+ except ImportError:
pass
else:
@@ -131,7 +131,7 @@ def execute(cmd_name, *args, **kw):
try:
exec("from cmd_%s import cli_options as %s_cli_options" % (command_name,command_name))
exec("%s_cli_options()" % (command_name))
- except ImportError, errmsg:
+ except ImportError:
pass
conf.finalize_conf()