summaryrefslogtreecommitdiffstats
path: root/pykolab/plugins
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/plugins
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/plugins')
-rw-r--r--pykolab/plugins/__init__.py20
-rw-r--r--pykolab/plugins/defaultfolders/__init__.py2
-rw-r--r--pykolab/plugins/recipientpolicy/__init__.py10
3 files changed, 16 insertions, 16 deletions
diff --git a/pykolab/plugins/__init__.py b/pykolab/plugins/__init__.py
index 82bf525..96e0044 100644
--- a/pykolab/plugins/__init__.py
+++ b/pykolab/plugins/__init__.py
@@ -67,15 +67,15 @@ class KolabPlugins(object):
exec("from pykolab.plugins import %s" % (plugin))
self.plugins[plugin] = True
self.load_plugins(plugins=[plugin])
- except ImportError, e:
+ except ImportError as e:
log.error(_("ImportError for plugin %s: %s") % (plugin, e))
traceback.print_exc()
self.plugins[plugin] = False
- except RuntimeError, e:
+ except RuntimeError as e:
log.error( _("RuntimeError for plugin %s: %s") % (plugin, e))
traceback.print_exc()
self.plugins[plugin] = False
- except Exception, e:
+ except Exception as e:
log.error(_("Plugin %s failed to load (%s: %s)") % (plugin, e.__class__, e))
traceback.print_exc()
except:
@@ -113,9 +113,9 @@ class KolabPlugins(object):
if hasattr(getattr(self, plugin), "set_defaults"):
try:
getattr(self, plugin).set_defaults(defaults)
- except TypeError, e:
+ except TypeError as e:
log.error(_("Cannot set defaults for plugin %s: %s") % (plugin, e))
- except RuntimeError, e:
+ except RuntimeError as e:
log.error(_("Cannot set defaults for plugin %s: %s") % (plugin, e))
except:
log.error(_("Cannot set defaults for plugin %s: Unknown Error") % (plugin))
@@ -139,7 +139,7 @@ class KolabPlugins(object):
if hasattr(getattr(self, plugin), "set_runtime"):
try:
getattr(self, plugin).set_runtime(runtime)
- except RuntimeError, e:
+ except RuntimeError as e:
log.error(_("Cannot set runtime for plugin %s: %s") % (plugin, e))
else:
log.debug(_("Not setting runtime for plugin %s: No function 'set_runtime()'") % (plugin), level=5)
@@ -160,9 +160,9 @@ class KolabPlugins(object):
if hasattr(getattr(self, plugin), "add_options"):
try:
exec("self.%s.add_options(parser)" % plugin)
- except RuntimeError, e:
+ except RuntimeError as e:
log.error(_("Cannot add options for plugin %s: %s") % (plugin, e))
- except TypeError, e:
+ except TypeError as e:
log.error(_("Cannot add options for plugin %s: %s") % (plugin, e))
else:
log.debug(_("Not adding options for plugin %s: No function 'add_options()'") % plugin, level=5)
@@ -184,7 +184,7 @@ class KolabPlugins(object):
if hasattr(getattr(self, plugin), "check_options"):
try:
exec("self.%s.check_options()" % plugin)
- except AttributeError, e:
+ except AttributeError as e:
log.error(_("Cannot check options for plugin %s: %s") % (plugin, e))
else:
log.debug(_("Not checking options for plugin %s: No function 'check_options()'") % (plugin), level=5)
@@ -262,7 +262,7 @@ class KolabPlugins(object):
if hasattr(getattr(self, plugin), bool):
try:
exec("boolval = self.%s.%s" % (plugin, bool))
- except AttributeError, e:
+ except AttributeError:
pass
else:
boolval = None
diff --git a/pykolab/plugins/defaultfolders/__init__.py b/pykolab/plugins/defaultfolders/__init__.py
index e098ec2..0b6ee10 100644
--- a/pykolab/plugins/defaultfolders/__init__.py
+++ b/pykolab/plugins/defaultfolders/__init__.py
@@ -49,7 +49,7 @@ class KolabDefaultfolders(object):
try:
exec("additional_folders = %s" % (kw['additional_folders']))
- except Exception, e:
+ except Exception:
log.error(_("Could not parse additional_folders"))
return {}
diff --git a/pykolab/plugins/recipientpolicy/__init__.py b/pykolab/plugins/recipientpolicy/__init__.py
index 23ba863..aab2a5e 100644
--- a/pykolab/plugins/recipientpolicy/__init__.py
+++ b/pykolab/plugins/recipientpolicy/__init__.py
@@ -75,7 +75,7 @@ class KolabRecipientpolicy(object):
mail = utils.translate(mail, user_attrs['preferredlanguage'])
mail = mail.lower()
return mail
- except KeyError, e:
+ except KeyError:
log.warning(_("Attribute substitution for 'mail' failed in Recipient Policy"))
if user_attrs.has_key('mail'):
return user_attrs['mail']
@@ -112,7 +112,7 @@ class KolabRecipientpolicy(object):
try:
exec("alternative_mail_routines = %s" % kw['secondary_mail'])
- except Exception, e:
+ except Exception:
log.error(_("Could not parse the alternative mail routines"))
alternative_mail = []
@@ -123,7 +123,7 @@ class KolabRecipientpolicy(object):
for attr in [ 'givenname', 'sn', 'surname' ]:
try:
user_attrs[attr] = utils.translate(user_attrs[attr], user_attrs['preferredlanguage'])
- except Exception, errmsg:
+ except Exception:
log.error(_("An error occurred in composing the secondary mail attribute for entry %r") % (user_attrs['id']))
if conf.debuglevel > 8:
import traceback
@@ -138,7 +138,7 @@ class KolabRecipientpolicy(object):
log.debug(_("Appending additional mail address: %s") % (retval), level=8)
alternative_mail.append(retval)
- except Exception, errmsg:
+ except Exception as errmsg:
log.error(_("Policy for secondary email address failed: %r") % (errmsg))
if conf.debuglevel > 8:
import traceback
@@ -153,7 +153,7 @@ class KolabRecipientpolicy(object):
log.debug(_("Appending additional mail address: %s") % (retval), level=8)
alternative_mail.append(retval)
- except KeyError, e:
+ except KeyError:
log.warning(_("Attribute substitution for 'alternative_mail' failed in Recipient Policy"))
alternative_mail = utils.normalize(alternative_mail)