-class PluginLoader(object):
-
- def __init__(self, baseobj, facility, plugin_type):
- (whitelist, config) = Store().get_plugins_config(facility)
- if cherrypy.config.get('debug', False):
- cherrypy.log('[%s] %s: %s' % (facility, whitelist, config))
- if whitelist is None:
- whitelist = []
- if config is None:
- config = dict()
+class PluginLoader(Log):
+
+ def __init__(self, baseobj, facility, plugin_type, uses_store=True):
+ self._pathname, _ = os.path.split(inspect.getfile(baseobj))
+ self.facility = facility
+ self._plugin_type = plugin_type
+ self.available = dict()
+ self.enabled = list()
+ self.__data = False
+ self.uses_store = uses_store
+
+ # Defer initialization or instantiating the store will fail at load
+ # time when used with Installer plugins as the cherrypy config context
+ # is created after all Installer plugins are loaded.
+ @property
+ def _data(self):
+ if not self.uses_store:
+ raise Exception('Tried to get plugin data while ' +
+ 'uses_store=False (%s)' % self.facility)
+ if not self.__data:
+ self.__data = AdminStore()
+ return self.__data
+
+ @property
+ def is_readonly(self):
+ return self._data.is_readonly