Browse Source

Add a small workarround for sicover plugin in multisite

Conditionnal plugins path given the context type (mono or multi site)
Yann Weber 7 years ago
parent
commit
95305a88ba
2 changed files with 10 additions and 5 deletions
  1. 2
    4
      lodel/context.py
  2. 8
    1
      lodel/plugin/plugins.py

+ 2
- 4
lodel/context.py View File

@@ -89,9 +89,6 @@ class LodelMetaPathFinder(importlib.abc.MetaPathFinder):
89 89
                 os.mkdir(mod_path)
90 90
                 fd = open(os.path.join(mod_path, '__init__.py'), 'w+')
91 91
                 fd.close()
92
-                #create a symlink to plugins pkg
93
-                os.symlink(os.path.join(lodel.__path__[0],'plugins'),
94
-                    os.path.join(lodel_pkg_path, 'plugins'), True)
95 92
             lodel_pkg_path = os.path.join(mod_path, 'lodel')
96 93
             if not os.path.exists(lodel_pkg_path):
97 94
                 os.symlink(lodel.__path__[0], lodel_pkg_path, True)
@@ -537,7 +534,8 @@ MONOSITE mode")
537 534
     #@return The module name in the current context
538 535
     def _translate(self, module_fullname):
539 536
     	#This test should be obsolete now
540
-        if module_fullname.startswith('lodel'):
537
+        if module_fullname.startswith('lodel') or \
538
+                module_fullname.startswith('leapi_dyncode'):
541 539
             if self.multisite():
542 540
                 return self.__pkg_name +'.'+ module_fullname
543 541
             else:

+ 8
- 1
lodel/plugin/plugins.py View File

@@ -64,7 +64,14 @@ PLUGIN_DEPS_VARNAME = '__plugin_deps__'
64 64
 ##@brief Name of the optionnal activate method
65 65
 ACTIVATE_METHOD_NAME = '_activate'
66 66
 ##@brief Default & failover value for plugins path list
67
-PLUGINS_PATH = os.path.join(LodelContext.context_dir(),'plugins')
67
+if LodelContext.multisite():
68
+    #When in multisite mode we fetch plugins list from context dir in the
69
+    #lodel pkg symlink
70
+    PLUGINS_PATH = os.path.join(LodelContext.context_dir(),'lodel/plugins')
71
+else:
72
+    #When in monosite mode, for the moment, the plugins list is fetched from
73
+    #a symlink in the instance dir
74
+    PLUGINS_PATH = os.path.join(LodelContext.context_dir(),'plugins')
68 75
 
69 76
 ##@brief List storing the mandatory variables expected in a plugin __init__.py
70 77
 #file

Loading…
Cancel
Save