Changeset View
Changeset View
Standalone View
Standalone View
pykolab/setup/components.py
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | def list_components(*args, **kw): | ||||
_components = __components.keys() | _components = __components.keys() | ||||
_components.sort() | _components.sort() | ||||
for _component in _components: | for _component in _components: | ||||
if __components[_component].has_key('function'): | if __components[_component].has_key('function'): | ||||
# This is a top-level component | # This is a top-level component | ||||
if not __components[_component]['description'] == None: | if not __components[_component]['description'] == None: | ||||
print "%-25s - %s" % (_component.replace('_','-'),__components[_component]['description']) | print("%-25s - %s" % (_component.replace('_','-'),__components[_component]['description'])) | ||||
else: | else: | ||||
print "%-25s" % (_component.replace('_','-')) | print("%-25s" % (_component.replace('_','-'))) | ||||
for _component in _components: | for _component in _components: | ||||
if not __components[_component].has_key('function'): | if not __components[_component].has_key('function'): | ||||
# This is a nested component | # This is a nested component | ||||
print "\n" + _("Command Group: %s") % (_component) + "\n" | print("\n" + _("Command Group: %s") % (_component) + "\n") | ||||
___components = __components[_component].keys() | ___components = __components[_component].keys() | ||||
___components.sort() | ___components.sort() | ||||
for __component in ___components: | for __component in ___components: | ||||
if not __components[_component][__component]['description'] == None: | if not __components[_component][__component]['description'] == None: | ||||
print "%-4s%-21s - %s" % ('',__component.replace('_','-'),__components[_component][__component]['description']) | print("%-4s%-21s - %s" % ('',__component.replace('_','-'),__components[_component][__component]['description'])) | ||||
else: | else: | ||||
print "%-4s%-21s" % ('',__component.replace('_','-')) | print("%-4s%-21s" % ('',__component.replace('_','-'))) | ||||
def _list_components(*args, **kw): | def _list_components(*args, **kw): | ||||
""" | """ | ||||
List components and return API compatible, parseable lists and | List components and return API compatible, parseable lists and | ||||
dictionaries. | dictionaries. | ||||
""" | """ | ||||
__components = {} | __components = {} | ||||
▲ Show 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | if callable(func): | ||||
'description': _("Alias for %s") % (component_name) | 'description': _("Alias for %s") % (component_name) | ||||
} | } | ||||
## | ## | ||||
## Commands not yet implemented | ## Commands not yet implemented | ||||
## | ## | ||||
def not_yet_implemented(*args, **kw): | def not_yet_implemented(*args, **kw): | ||||
print _("Not yet implemented") | print(_("Not yet implemented")) | ||||
sys.exit(1) | sys.exit(1) |