MCPcopy Index your code
hub / github.com/fluentpython/example-code-2e / install

Method install

21-async/mojifinder/bottle.py:714–724  ·  view source on GitHub ↗

Add a plugin to the list of plugins and prepare it for being applied to all routes of this application. A plugin may be a simple decorator or an object that implements the :class:`Plugin` API.

(self, plugin)

Source from the content-addressed store, hash-verified

712 self.add_route(route)
713
714 def install(self, plugin):
715 ''' Add a plugin to the list of plugins and prepare it for being
716 applied to all routes of this application. A plugin may be a simple
717 decorator or an object that implements the :class:`Plugin` API.
718 '''
719 if hasattr(plugin, 'setup'): plugin.setup(self)
720 if not callable(plugin) and not hasattr(plugin, 'apply'):
721 raise TypeError("Plugins must be callable or implement .apply()")
722 self.plugins.append(plugin)
723 self.reset()
724 return plugin
725
726 def uninstall(self, plugin):
727 ''' Uninstall plugins. Pass an instance to remove a specific plugin, a type

Callers 2

__init__Method · 0.95
runFunction · 0.80

Calls 2

resetMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected