Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

PluginManager now wraps an existing set of plugins and is used by all…

… loaders to wrap their results.
  • Loading branch information...
commit 46b9cb3b13d5e01366d0e7cb591e245e2b2a4fe4 1 parent 55eff90
ironfroggy authored
Showing with 5 additions and 14 deletions.
  1. +3 −1 straight/plugin/loaders.py
  2. +2 −13 straight/plugin/manager.py
4 straight/plugin/loaders.py
View
@@ -6,6 +6,8 @@
from importlib import import_module
from imp import find_module
+from straight.plugin.manager import PluginManager
+
class Loader(object):
@@ -16,7 +18,7 @@ def load(self, *args, **kwargs):
self._fill_cache(*args, **kwargs)
self._post_fill()
self._order()
- return self._cache
+ return PluginManager(self._cache)
def _meta(self, plugin):
meta = getattr(plugin, '__plugin__', None)
15 straight/plugin/manager.py
View
@@ -1,18 +1,7 @@
-import straight.plugin.loaders
-
-
class PluginManager(object):
- def __init__(self, loader=None):
- self.loader = loader
- self._plugins = []
-
- def load(self, *args, **kwargs):
- if self.loader is not None:
- new_plugins = self.loader.load(*args, **kwargs)
- else:
- new_plugins = straight.plugin.loaders.unified_load(*args, **kwargs)
- self._plugins.extend(new_plugins)
+ def __init__(self, plugins):
+ self._plugins = plugins
def __iter__(self):
return iter(self._plugins)
Please sign in to comment.
Something went wrong with that request. Please try again.