Exemple #1
0
def wrap_cli_manager(manager, plugin):
    """Wraps all commands of a flask-script `Manager` in a plugin context.

    This actually clones the manager, so the original one is left untouched.
    """
    manager = deepcopy(manager)
    for name, command in manager._commands.iteritems():
        command = deepcopy(command)
        command.run = wrap_in_plugin_context(plugin, command.run)
        manager._commands[name] = command
    return manager
Exemple #2
0
def wrap_cli_manager(manager, plugin):
    """Wraps all commands of a flask-script `Manager` in a plugin context.

    This actually clones the manager, so the original one is left untouched.
    """
    manager = deepcopy(manager)
    for name, command in manager._commands.iteritems():
        command = deepcopy(command)
        command.run = wrap_in_plugin_context(plugin, command.run)
        manager._commands[name] = command
    return manager
Exemple #3
0
 def connect(self, signal, receiver, **connect_kwargs):
     connect_kwargs['weak'] = False
     func = wrap_in_plugin_context(self, receiver)
     func.indico_plugin = self
     signal.connect(func, **connect_kwargs)
Exemple #4
0
 def connect(self, signal, receiver, **connect_kwargs):
     connect_kwargs['weak'] = False
     func = wrap_in_plugin_context(self, receiver)
     func.indico_plugin = self
     signal.connect(func, **connect_kwargs)
Exemple #5
0
 def _wrap_in_plugin_context(self, plugin, cmd):
     cmd.callback = wrap_in_plugin_context(plugin, cmd.callback)
     for subcmd in getattr(cmd, 'commands', {}).values():
         self._wrap_in_plugin_context(plugin, subcmd)
Exemple #6
0
 def _wrap_in_plugin_context(self, plugin, cmd):
     cmd.callback = wrap_in_plugin_context(plugin, cmd.callback)
     for subcmd in getattr(cmd, 'commands', {}).viewvalues():
         self._wrap_in_plugin_context(plugin, subcmd)