Example #1
0
    def handle(self, *args, **kwargs):
        names = [n.upper() for n in args]
        for module in modules():
            if module.verbose_name.upper() in names:
                if module.enabled:
                    module.restart()
                    names.remove(module.verbose_name.upper())

                else:
                    raise CommandError('Module %s is disabled' %
                                       module.verbose_name)

        if names:
            raise CommandError('Module %s does not exist' % ','.join(names))
Example #2
0
def menu():
    """
    Return global menu composed from all modules menu.

    This method will compose the global menu by calling menu() function for
    module, it should be located under module_path.menu module
    """
    root = MenuItem('')

    for mod in droplet.modules():
        if mod.installed:
            module_path = mod.__class__.__module__.rsplit('.', 1)[0]
            menu = import_module(module_path + '.menu')
            if menu:
                menu.menu(root)

    return root
Example #3
0
    def get_object(self, name):
        for module in droplet.modules():
            if module.name == name:
                return module

        raise KeyError('Module %s not found' % name)
Example #4
0
 def objects(self):
     return droplet.modules()