refs #579 do not load modules unconditionally, look for everything in the module paths

modules
Natalia Serrano 2024-08-28 15:11:49 +02:00
parent 53f44ad3ab
commit 0cadbf3381
3 changed files with 4 additions and 5 deletions

View File

@ -4,7 +4,7 @@ address=0.0.0.0
port=8000
# This is a comma separated list of paths where to look for modules to load
path=test_modules/server
#path=test_modules/server,more_modules/server
# Remote OpenGnsys Service
remote=https://192.168.2.10/opengnsys/rest
@ -21,7 +21,7 @@ log=DEBUG
# The sections must match the module name
# This section will be passes on activation to module
[ogAdmClient]
#path=test_modules/server
#path=test_modules/server,more_modules/server
## this URL will probably be left equal to the other one, but let's see
remote=https://192.168.2.10/opengnsys/rest
log=DEBUG

View File

@ -35,6 +35,7 @@
# Modules under "opengsnsys/modules" are always autoloaded
import sys
import pkgutil
import os.path
@ -55,12 +56,10 @@ def loadModules(controller, client=False):
ogModules = []
if client is False:
from opengnsys.modules.server import OpenGnSys # @UnusedImport
from .modules import server # @UnusedImport, just used to ensure opengnsys modules are initialized
modPath = 'opengnsys.modules.server'
modType = ServerWorker
else:
from opengnsys.modules.client import OpenGnSys # @UnusedImport @Reimport
from .modules import client # @UnusedImport, just used to ensure opengnsys modules are initialized
modPath = 'opengnsys.modules.client'
modType = ClientWorker
@ -98,7 +97,7 @@ def loadModules(controller, client=False):
else:
paths = ()
# paths += (os.path.dirname(sys.modules[modPath].__file__),)
paths += (os.path.dirname(sys.modules[modPath].__file__),)
# Load modules
logger.debug('Loading modules from {}'.format(paths))