|
@@ -41,8 +41,8 @@ DEFAULT_PLUGINS_PATH_LIST = ['./plugins']
|
41
|
41
|
MANDATORY_VARNAMES = [PLUGIN_NAME_VARNAME, LOADER_FILENAME_VARNAME,
|
42
|
42
|
PLUGIN_VERSION_VARNAME]
|
43
|
43
|
|
44
|
|
-PLUGIN_DEFAULT_TYPE = 'default'
|
45
|
|
-PLUGINS_TYPES = [PLUGIN_DEFAULT_TYPE, 'datasource', 'session_handler', 'ui']
|
|
44
|
+EXTENSIONS = 'default'
|
|
45
|
+PLUGINS_TYPES = [EXTENSIONS, 'datasource', 'session_handler', 'ui']
|
46
|
46
|
|
47
|
47
|
|
48
|
48
|
##@brief Describe and handle version numbers
|
|
@@ -248,7 +248,7 @@ init file. Malformed plugin"
|
248
|
248
|
try:
|
249
|
249
|
self.__type = getattr(self.module, PLUGIN_TYPE_VARNAME)
|
250
|
250
|
except AttributeError:
|
251
|
|
- self.__type = PLUGIN_DEFAULT_TYPE
|
|
251
|
+ self.__type = EXTENSIONS
|
252
|
252
|
self.__type = str(self.__type).lower()
|
253
|
253
|
if self.__type not in PLUGINS_TYPES:
|
254
|
254
|
raise PluginError("Unknown plugin type '%s'" % self.__type)
|
|
@@ -296,7 +296,7 @@ name differ from the one found in plugin's init file"
|
296
|
296
|
filename = os.path.join(self.path, filename)
|
297
|
297
|
loader = SourceFileLoader(module_name, filename)
|
298
|
298
|
return loader.load_module()
|
299
|
|
-
|
|
299
|
+
|
300
|
300
|
##@brief Check dependencies of plugin
|
301
|
301
|
#@return A list of plugin name to be loaded before
|
302
|
302
|
def check_deps(self):
|
|
@@ -419,7 +419,8 @@ name differ from the one found in plugin's init file"
|
419
|
419
|
from lodel.plugin.hooks import LodelHook
|
420
|
420
|
LodelHook.call_hook(
|
421
|
421
|
"lodel2_plugins_loaded", cls, cls._plugin_instances)
|
422
|
|
-
|
|
422
|
+
|
|
423
|
+
|
423
|
424
|
##@return a copy of __confspecs attr
|
424
|
425
|
@property
|
425
|
426
|
def confspecs(self):
|
|
@@ -785,3 +786,18 @@ with %s" % (custom_method._method_name, custom_method))
|
785
|
786
|
# - an _activate() method that returns True if the plugin can be activated (
|
786
|
787
|
# optionnal)
|
787
|
788
|
#
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+class SessionHandler(Plugin):
|
|
795
|
+ __instance = None
|
|
796
|
+
|
|
797
|
+ def __new__(cls):
|
|
798
|
+ if cls.__instance == None:
|
|
799
|
+ cls.instance == object.__new__(cls)
|
|
800
|
+ return cls.__instance
|
|
801
|
+
|
|
802
|
+ def __init__(self, plugin_name):
|
|
803
|
+ super(Plugin, self).__init__(plugin_name)
|