summaryrefslogtreecommitdiffstats
path: root/pykolab/plugins
diff options
context:
space:
mode:
authorChristoph Erhardt <kolab@sicherha.de>2022-08-12 09:56:45 +0200
committerChristoph Erhardt <kolab@sicherha.de>2022-08-12 09:57:00 +0200
commite02d1240e6586d2950a3f8ad760b2225af07d0ad (patch)
tree0e77fb69f00e4f31e08e84126a9ae6dc0a8c737e /pykolab/plugins
parent289cf24e653f3186fb8066b7f8c0e8822601af42 (diff)
downloadpykolab-master.tar.gz
[Python 3]exec to eval where exec(" var = ...")HEADmaster
Summary: All exec() with (var = ...) exec() with (import ... ) or with (self.var = ..) or just with (function()) should work out of the box. If not worked as expected, they could be grouped and put into other diff s. Reviewers: #pykolab_developers, sicherha Reviewed By: #pykolab_developers, sicherha Differential Revision: https://git.kolab.org/D3638
Diffstat (limited to 'pykolab/plugins')
-rw-r--r--pykolab/plugins/__init__.py4
-rw-r--r--pykolab/plugins/defaultfolders/__init__.py2
-rw-r--r--pykolab/plugins/recipientpolicy/__init__.py6
3 files changed, 6 insertions, 6 deletions
diff --git a/pykolab/plugins/__init__.py b/pykolab/plugins/__init__.py
index 96e0044..ab110fb 100644
--- a/pykolab/plugins/__init__.py
+++ b/pykolab/plugins/__init__.py
@@ -204,7 +204,7 @@ class KolabPlugins(object):
continue
if hasattr(getattr(self, plugin), "%s_%s" % (func, option)):
- exec("retval = getattr(self, plugin).%s_%s(val)" % (func, option))
+ retval = eval("getattr(self, plugin).%s_%s(val)" % (func, option))
return retval
return False
@@ -261,7 +261,7 @@ class KolabPlugins(object):
if hasattr(getattr(self, plugin), bool):
try:
- exec("boolval = self.%s.%s" % (plugin, bool))
+ boolval = eval("self.%s.%s" % (plugin, bool))
except AttributeError:
pass
else:
diff --git a/pykolab/plugins/defaultfolders/__init__.py b/pykolab/plugins/defaultfolders/__init__.py
index a4a59b0..cfa6d28 100644
--- a/pykolab/plugins/defaultfolders/__init__.py
+++ b/pykolab/plugins/defaultfolders/__init__.py
@@ -48,7 +48,7 @@ class KolabDefaultfolders(object):
return {}
try:
- exec("additional_folders = %s" % (kw['additional_folders']))
+ additional_folders = eval("%s" % (kw['additional_folders']))
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 330ddfa..da1db06 100644
--- a/pykolab/plugins/recipientpolicy/__init__.py
+++ b/pykolab/plugins/recipientpolicy/__init__.py
@@ -111,7 +111,7 @@ class KolabRecipientpolicy(object):
user_attrs['preferredlanguage'] = default_locale
try:
- exec("alternative_mail_routines = %s" % kw['secondary_mail'])
+ alternative_mail_routines = eval("%s" % kw['secondary_mail'])
except Exception:
log.error(_("Could not parse the alternative mail routines"))
@@ -133,7 +133,7 @@ class KolabRecipientpolicy(object):
for number in alternative_mail_routines:
for routine in alternative_mail_routines[number]:
try:
- exec("retval = '%s'.%s" % (routine,alternative_mail_routines[number][routine] % user_attrs))
+ retval = eval("'%s'.%s" % (routine, alternative_mail_routines[number][routine] % user_attrs))
log.debug(_("Appending additional mail address: %s") % (retval), level=8)
alternative_mail.append(retval)
@@ -148,7 +148,7 @@ class KolabRecipientpolicy(object):
for _domain in kw['secondary_domains']:
user_attrs['domain'] = _domain
try:
- exec("retval = '%s'.%s" % (routine,alternative_mail_routines[number][routine] % user_attrs))
+ retval = eval("'%s'.%s" % (routine, alternative_mail_routines[number][routine] % user_attrs))
log.debug(_("Appending additional mail address: %s") % (retval), level=8)
alternative_mail.append(retval)