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)
| 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 |