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
                 os.mkdir(mod_path)
89
                 os.mkdir(mod_path)
90
                 fd = open(os.path.join(mod_path, '__init__.py'), 'w+')
90
                 fd = open(os.path.join(mod_path, '__init__.py'), 'w+')
91
                 fd.close()
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
             lodel_pkg_path = os.path.join(mod_path, 'lodel')
92
             lodel_pkg_path = os.path.join(mod_path, 'lodel')
96
             if not os.path.exists(lodel_pkg_path):
93
             if not os.path.exists(lodel_pkg_path):
97
                 os.symlink(lodel.__path__[0], lodel_pkg_path, True)
94
                 os.symlink(lodel.__path__[0], lodel_pkg_path, True)
537
     #@return The module name in the current context
534
     #@return The module name in the current context
538
     def _translate(self, module_fullname):
535
     def _translate(self, module_fullname):
539
     	#This test should be obsolete now
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
             if self.multisite():
539
             if self.multisite():
542
                 return self.__pkg_name +'.'+ module_fullname
540
                 return self.__pkg_name +'.'+ module_fullname
543
             else:
541
             else:

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

64
 ##@brief Name of the optionnal activate method
64
 ##@brief Name of the optionnal activate method
65
 ACTIVATE_METHOD_NAME = '_activate'
65
 ACTIVATE_METHOD_NAME = '_activate'
66
 ##@brief Default & failover value for plugins path list
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
 ##@brief List storing the mandatory variables expected in a plugin __init__.py
76
 ##@brief List storing the mandatory variables expected in a plugin __init__.py
70
 #file
77
 #file

Loading…
Cancel
Save