summaryrefslogtreecommitdiffstats
path: root/pykolab/setup/components.py
diff options
context:
space:
mode:
authorChristoph Erhardt <kolab@sicherha.de>2021-06-05 11:51:27 +0200
committerChristoph Erhardt <kolab@sicherha.de>2022-01-10 20:50:41 +0100
commit9a5f92139d3fbe7fa1945d38198a9cdc74831ac5 (patch)
tree03fff0f479a90dfaa70c6647dd0923086560dcca /pykolab/setup/components.py
parentc3b9d5557161f840a8f2c45fc91ec09299593dd9 (diff)
downloadpykolab-9a5f92139d3fbe7fa1945d38198a9cdc74831ac5.tar.gz
[Python 3] Get rid of .has_key()
Summary: `dict.has_key(key)` was dropped in Python 3.0. Use `key in dict` instead. Reviewers: machniak, mollekopf Reviewed By: mollekopf Differential Revision: https://git.kolab.org/D3241
Diffstat (limited to 'pykolab/setup/components.py')
-rw-r--r--pykolab/setup/components.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/pykolab/setup/components.py b/pykolab/setup/components.py
index f68bb48..49a4f65 100644
--- a/pykolab/setup/components.py
+++ b/pykolab/setup/components.py
@@ -77,7 +77,7 @@ def list_components(*args, **kw):
_components.sort()
for _component in _components:
- if __components[_component].has_key('function'):
+ if 'function' in __components[_component]:
# This is a top-level component
if not __components[_component]['description'] == None:
print("%-25s - %s" % (_component.replace('_','-'),__components[_component]['description']))
@@ -85,7 +85,7 @@ def list_components(*args, **kw):
print("%-25s" % (_component.replace('_','-')))
for _component in _components:
- if not __components[_component].has_key('function'):
+ if 'function' not in __components[_component]:
# This is a nested component
print("\n" + _("Command Group: %s") % (_component) + "\n")
___components = __components[_component].keys()
@@ -124,7 +124,7 @@ def cli_options_from_component(component_name, *args, **kw):
if component_name in components_included_in_cli:
return
- if components[component_name].has_key('group'):
+ if 'group' in components[component_name]:
group = components[component_name]['group']
component_name = components[component_name]['component_name']
try:
@@ -161,7 +161,7 @@ def execute(component_name, *args, **kw):
execute_this = False
if execute_this:
- if components[component].has_key('after'):
+ if 'after' in components[component]:
for _component in components[component]['after']:
if not _component in executed_components:
execute_this = False
@@ -183,12 +183,12 @@ def execute(component_name, *args, **kw):
for component in _list_components():
cli_options_from_component(component)
- if not components.has_key(component_name):
+ if component_name not in components:
log.error(_("No such component."))
sys.exit(1)
- if not components[component_name].has_key('function') and \
- not components[component_name].has_key('group'):
+ if 'function' not in components[component_name] and \
+ 'group' not in components[component_name]:
log.error(_("No such component."))
sys.exit(1)
@@ -227,7 +227,7 @@ def register(component_name, func, group=None, description=None, aliases=[], aft
if isinstance(aliases, basestring):
aliases = [aliases]
- if components.has_key(component):
+ if component in components:
log.fatal(_("Command '%s' already registered") % (component))
sys.exit(1)