ソースを参照

python import instead of expose_module, LodelContext still used for getting module and other stuff

prieto 7年前
コミット
170eabee69
82個のファイルの変更201行の追加540行の削除
  1. 0
    5
      debian/changelog
  2. 0
    1
      debian/compat
  3. 0
    14
      debian/control
  4. 0
    20
      debian/debhelper.log
  5. 0
    1
      debian/files
  6. 0
    22
      debian/rules
  7. 0
    1
      debian/substvars
  8. 0
    10
      debian/tmp/DEBIAN/control
  9. 0
    1
      debian/tmp/DEBIAN/md5sums
  10. バイナリ
      debian/tmp/usr/share/doc/lodel2/changelog.gz
  11. バイナリ
      doc/img/dia/auth_client_user_session.dia
  12. バイナリ
      doc/img/dia/authorizations_handling.dia
  13. バイナリ
      doc/img/dia/session_creation.dia
  14. 0
    14
      doc/img/graphviz/Makefile
  15. バイナリ
      doc/img/openedition_logo.png
  16. 0
    2
      editorial_models/em_simple.py
  17. 0
    5
      em_test.py
  18. 5
    8
      lodel/auth/client.py
  19. 2
    5
      lodel/auth/exceptions.py
  20. 5
    9
      lodel/editorial_model/components.py
  21. 8
    10
      lodel/editorial_model/model.py
  22. 3
    6
      lodel/editorial_model/translator/xmlfile.py
  23. 6
    20
      lodel/leapi/datahandlers/base_classes.py
  24. 2
    7
      lodel/leapi/datahandlers/datas.py
  25. 2
    7
      lodel/leapi/datahandlers/datas_base.py
  26. 3
    10
      lodel/leapi/datahandlers/references.py
  27. 2
    3
      lodel/leapi/exceptions.py
  28. 7
    12
      lodel/leapi/lefactory.py
  29. 1
    1
      lodel/leapi/lefactory_common.py
  30. 11
    17
      lodel/leapi/leobject.py
  31. 3
    7
      lodel/leapi/query.py
  32. 2
    8
      lodel/logger.py
  33. 2
    3
      lodel/mlnamedobject/mlnamedobject.py
  34. 6
    8
      lodel/plugin/__init__.py
  35. 5
    9
      lodel/plugin/core_hooks.py
  36. 3
    4
      lodel/plugin/core_scripts.py
  37. 7
    12
      lodel/plugin/datasource_plugin.py
  38. 3
    6
      lodel/plugin/extensions.py
  39. 1
    3
      lodel/plugin/hooks.py
  40. 4
    6
      lodel/plugin/interface.py
  41. 9
    18
      lodel/plugin/plugins.py
  42. 3
    5
      lodel/plugin/scripts.py
  43. 3
    6
      lodel/plugin/sessionhandler.py
  44. 1
    3
      lodel/plugins/dummy/__init__.py
  45. 1
    3
      lodel/plugins/dummy/confspec.py
  46. 2
    4
      lodel/plugins/dummy/main.py
  47. 1
    3
      lodel/plugins/dummy_datasource/__init__.py
  48. 1
    3
      lodel/plugins/dummy_datasource/datasource.py
  49. 1
    3
      lodel/plugins/dummy_datasource/main.py
  50. 0
    2
      lodel/plugins/dummy_datasource/migration_handler.py
  51. 1
    3
      lodel/plugins/filesystem_session/__init__.py
  52. 1
    3
      lodel/plugins/filesystem_session/confspec.py
  53. 3
    6
      lodel/plugins/filesystem_session/main.py
  54. 1
    5
      lodel/plugins/mongodb_datasource/confspec.py
  55. 5
    7
      lodel/plugins/mongodb_datasource/datasource.py
  56. 1
    4
      lodel/plugins/mongodb_datasource/exceptions.py
  57. 1
    3
      lodel/plugins/mongodb_datasource/main.py
  58. 5
    7
      lodel/plugins/mongodb_datasource/migration_handler.py
  59. 2
    4
      lodel/plugins/mongodb_datasource/utils.py
  60. 1
    4
      lodel/plugins/multisite/__init__.py
  61. 1
    3
      lodel/plugins/multisite/confspecs.py
  62. 5
    13
      lodel/plugins/multisite/loader.py
  63. 11
    16
      lodel/plugins/multisite/run.py
  64. 1
    3
      lodel/plugins/ram_sessions/__init__.py
  65. 3
    6
      lodel/plugins/ram_sessions/main.py
  66. 1
    2
      lodel/plugins/webui/client.py
  67. 1
    3
      lodel/plugins/webui/confspec.py
  68. 1
    4
      lodel/plugins/webui/exceptions.py
  69. 6
    7
      lodel/plugins/webui/interface/controllers/admin.py
  70. 2
    2
      lodel/plugins/webui/interface/controllers/listing.py
  71. 2
    2
      lodel/plugins/webui/interface/controllers/users.py
  72. 1
    3
      lodel/plugins/webui/interface/router.py
  73. 1
    2
      lodel/plugins/webui/interface/template/loader.py
  74. 2
    4
      lodel/plugins/webui/main.py
  75. 4
    10
      lodel/plugins/webui/run.py
  76. 1
    3
      lodel/settings/__init__.py
  77. 5
    10
      lodel/settings/settings.py
  78. 4
    6
      lodel/settings/settings_loader.py
  79. 6
    12
      lodel/validator/validator.py
  80. 0
    40
      nocontext_tests.py
  81. 0
    1
      plugins
  82. 7
    15
      progs/slim/install_model/loader.py

+ 0
- 5
debian/changelog ファイルの表示

1
-lodel2 (0.1) UNRELEASED; urgency=medium
2
-
3
-  * First debian package
4
-
5
- -- Yann Weber <yann.weber@openedition.org>  Fri, 23 Sep 2016 12:09:29 +0200

+ 0
- 1
debian/compat ファイルの表示

1
-9

+ 0
- 14
debian/control ファイルの表示

1
-Source: lodel2
2
-Section: python
3
-Priority: optional
4
-Maintainer: lodel2 dev team
5
-Build-Depends: make, dpkg-dev, dh-make, python3, python3-lxml
6
-Standards-Version: 0.1.1
7
-
8
-Package: lodel2
9
-Section: python
10
-Description: lodel2 debian package
11
-Architecture: any
12
-Depends: python3, python3-lxml, python3-jinja2, python3-werkzeug, python3-pymongo, uwsgi-plugin-python3, make
13
-Suggests: pwgen, wamerican, mongodb-server
14
-Provides: lodel

+ 0
- 20
debian/debhelper.log ファイルの表示

1
-dh_auto_configure
2
-dh_auto_build
3
-dh_auto_test
4
-dh_prep
5
-dh_auto_install
6
-dh_installdocs
7
-dh_installchangelogs
8
-dh_pysupport
9
-dh_perl
10
-dh_link
11
-dh_compress
12
-dh_fixperms
13
-dh_strip
14
-dh_makeshlibs
15
-dh_shlibdeps
16
-dh_installdeb
17
-dh_gencontrol
18
-dh_md5sums
19
-dh_builddeb
20
-dh_builddeb

+ 0
- 1
debian/files ファイルの表示

1
-lodel2_0.1_amd64.deb python optional

+ 0
- 22
debian/rules ファイルの表示

1
-#!/usr/bin/make -f
2
-# consulter debhelper(7) (décommenter lorsque nécessaire)
3
-# afficher chaque commande modifiant un fichier dans le système construit
4
-#DH_VERBOSE = 1
5
-
6
-# consulter EXAMPLES dans dpkg-buildflags(1) et lire /usr/share/dpkg/*
7
-DPKG_EXPORT_BUILDFLAGS = 1
8
-include /usr/share/dpkg/default.mk
9
-
10
-# consulter FEATURE AREAS dans dpkg-buildflags(1)
11
-#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
12
-
13
-# consulter ENVIRONMENT dans dpkg-buildflags(1)
14
-# mainteneurs de paquet à ajouter à CFLAGS
15
-#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
16
-# mainteneurs de paquet à ajouter à append LDFLAGS
17
-#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
18
-
19
-# principal script d’empaquetage basé sur la syntaxe de dh7
20
-%:
21
-	dh $@ --with python3
22
-

+ 0
- 1
debian/substvars ファイルの表示

1
-misc:Depends=

+ 0
- 10
debian/tmp/DEBIAN/control ファイルの表示

1
-Package: lodel2
2
-Version: 0.1
3
-Architecture: amd64
4
-Maintainer: lodel2 dev team
5
-Installed-Size: 25
6
-Depends: python3, python3-lxml, python3-jinja2, python3-werkzeug, python3-pymongo, uwsgi-plugin-python3
7
-Suggests: pwgen, wamerican, mongodb-server
8
-Provides: lodel
9
-Section: python
10
-Priority: optional

+ 0
- 1
debian/tmp/DEBIAN/md5sums ファイルの表示

1
-0377daa43e7232c06b702078dd86b850  usr/share/doc/lodel2/changelog.gz

バイナリ
debian/tmp/usr/share/doc/lodel2/changelog.gz ファイルの表示


バイナリ
doc/img/dia/auth_client_user_session.dia ファイルの表示


バイナリ
doc/img/dia/authorizations_handling.dia ファイルの表示


バイナリ
doc/img/dia/session_creation.dia ファイルの表示


+ 0
- 14
doc/img/graphviz/Makefile ファイルの表示

1
-dotfiles := $(wildcard *.dot)
2
-images := $(patsubst %.dot,%.png,$(wildcard *.dot))
3
-
4
-all: $(images)
5
-	
6
-%.png: %.dot
7
-	dot -Tpng $< > $@
8
-
9
-.PHONY: clean distclean
10
-
11
-clean:
12
-	-rm $(images)
13
-
14
-distclean: clean

バイナリ
doc/img/openedition_logo.png ファイルの表示


+ 0
- 2
editorial_models/em_simple.py ファイルの表示

4
 import os, os.path
4
 import os, os.path
5
 
5
 
6
 sys.path.append(os.path.dirname(os.getcwd()+'/..'))
6
 sys.path.append(os.path.dirname(os.getcwd()+'/..'))
7
-from lodel.context import LodelContext
8
-LodelContext.init()
9
 
7
 
10
 from lodel.settings.settings import Settings as settings
8
 from lodel.settings.settings import Settings as settings
11
 settings('globconf.d')
9
 settings('globconf.d')

+ 0
- 5
em_test.py ファイルの表示

1
 #!/usr/bin/python3
1
 #!/usr/bin/python3
2
-#-*- coding: utf-8 -*-
3
-
4
-from lodel.context import LodelContext
5
-LodelContext.init()
6
-
7
 from lodel.settings.settings import Settings as settings
2
 from lodel.settings.settings import Settings as settings
8
 settings('globconf.d')
3
 settings('globconf.d')
9
 from lodel.settings import Settings
4
 from lodel.settings import Settings

+ 5
- 8
lodel/auth/client.py ファイルの表示

5
 import warnings
5
 import warnings
6
 import inspect
6
 import inspect
7
 
7
 
8
-from lodel.context import LodelContext
9
-LodelContext.expose_modules(globals(), {
10
-    'lodel.settings': ['Settings'],
11
-    'lodel.logger': 'logger',
12
-    'lodel.plugin': [('SessionHandlerPlugin', 'SessionHandler')],
13
-    'lodel.auth.exceptions': ['ClientError', 'ClientAuthenticationFailure',
14
-                              'ClientPermissionDenied', 'ClientAuthenticationError'],
15
-    'lodel.leapi.query': ['LeGetQuery'], })
8
+from lodel.settings import Settings
9
+from lodel.logger import logger,
10
+from lodel.plugin import SessionHandlerPlugin, SessionHandler
11
+from lodel.auth.exceptions import ClientError, ClientAuthenticationFailure, ClientPermissionDenied, ClientAuthenticationError
12
+from lodel.leapi.query import LeGetQuery
16
 
13
 
17
 ## @brief Client metaclass designed to implements container accessor on
14
 ## @brief Client metaclass designed to implements container accessor on
18
 # Client Class
15
 # Client Class

+ 2
- 5
lodel/auth/exceptions.py ファイルの表示

1
 # @package lodel.auth.exceptions
1
 # @package lodel.auth.exceptions
2
 # @brief Defines the specific exceptions used in the authentication process
2
 # @brief Defines the specific exceptions used in the authentication process
3
 
3
 
4
-from lodel.context import LodelContext
5
-
6
-LodelContext.expose_modules(globals(), {
7
-    'lodel.logger': 'logger',
8
-    'lodel.plugin.hooks': ['LodelHook']})
4
+from lodel.logger import logger
5
+from lodel.plugin.hooks import LodelHook
9
 
6
 
10
 
7
 
11
 ## @brief Handles common errors with a Client
8
 ## @brief Handles common errors with a Client

+ 5
- 9
lodel/editorial_model/components.py ファイルの表示

1
-#-*- coding: utf-8 -*-
2
-
3
 # @package lodel.editorial_model.components
1
 # @package lodel.editorial_model.components
4
 #@brief Defines all @ref lodel2_em "EM" components
2
 #@brief Defines all @ref lodel2_em "EM" components
5
 #@ingroup lodel2_em
3
 #@ingroup lodel2_em
9
 import copy
7
 import copy
10
 import hashlib
8
 import hashlib
11
 
9
 
12
-from lodel.context import LodelContext
13
-LodelContext.expose_modules(globals(), {
14
-    'lodel.utils.mlstring': ['MlString'],
15
-    'lodel.mlnamedobject.mlnamedobject': ['MlNamedObject'],
16
-    'lodel.settings': ['Settings'],
17
-    'lodel.editorial_model.exceptions': ['EditorialModelError', 'assert_edit'],
18
-    'lodel.leapi.leobject': ['CLASS_ID_FIELDNAME']})
10
+from lodel.utils.mlstring import MlString
11
+from lodel.mlnamedobject.mlnamedobject import MlNamedObject
12
+from lodel.settings import import Settings
13
+from lodel.editorial_model.exceptions import EditorialModelError, assert_edit
14
+from lodel.leapi.leobject import CLASS_ID_FIELDNAME
19
 
15
 
20
 ## @brief Abstract class to represent editorial model components
16
 ## @brief Abstract class to represent editorial model components
21
 # @see EmClass EmField
17
 # @see EmClass EmField

+ 8
- 10
lodel/editorial_model/model.py ファイルの表示

4
 import importlib
4
 import importlib
5
 import copy
5
 import copy
6
 
6
 
7
-from lodel.context import LodelContext
8
-LodelContext.expose_modules(globals(), {
9
-    'lodel.utils.mlstring': ['MlString'],
10
-    'lodel.mlnamedobject.mlnamedobject': ['MlNamedObject'],
11
-    'lodel.logger': 'logger',
12
-    'lodel.settings': ['Settings'],
13
-    'lodel.settings.utils': ['SettingsError'],
14
-    'lodel.leapi.datahandlers.base_classes': ['DataHandler'],
15
-    'lodel.editorial_model.exceptions': ['EditorialModelError', 'assert_edit'],
16
-    'lodel.editorial_model.components': ['EmClass', 'EmField', 'EmGroup']})
17
 
7
 
8
+from lodel.utils.mlstring import MlString
9
+from lodel.mlnamedobject.mlnamedobject import MlNamedObject
10
+from lodel.settings import import Settings
11
+from lodel.editorial_model.exceptions import EditorialModelError, assert_edit
12
+from lodel.logger import logger
13
+from lodel.settings.utils import SettingsError
14
+from lodel.leapi.datahandlers.base_classes import DataHandler
15
+from lodel.editorial_model.components import EmClass, EmField, EmGroup
18
 
16
 
19
 ## @brief Describe an editorial model
17
 ## @brief Describe an editorial model
20
 #@ingroup lodel2_em
18
 #@ingroup lodel2_em

+ 3
- 6
lodel/editorial_model/translator/xmlfile.py ファイルの表示

4
 import os
4
 import os
5
 from lxml import etree
5
 from lxml import etree
6
 
6
 
7
-from lodel.context import LodelContext
8
-LodelContext.expose_modules(globals(), {
9
-    'lodel.editorial_model.model': ['EditorialModel'],
10
-    'lodel.editorial_model.components': ['EmComponent', 'EmClass', 'EmField',
11
-        'EmGroup'],
12
-    'lodel.utils.mlstring': ['MlString']})
7
+from lodel.editorial_model.model import EditorialModel
8
+from lodel.editorial_model.components import EmComponent, EmClass, EmField, EmGroup
9
+from lodel.utils.mlstring import MlString
13
 
10
 
14
 ## @package lodel.editorial_model.translator.xmlfile
11
 ## @package lodel.editorial_model.translator.xmlfile
15
 # This module is a translator toolkit between and editorial model and an XML file.
12
 # This module is a translator toolkit between and editorial model and an XML file.

+ 6
- 20
lodel/leapi/datahandlers/base_classes.py ファイルの表示

10
 import inspect
10
 import inspect
11
 import warnings
11
 import warnings
12
 
12
 
13
-from lodel.context import LodelContext
14
-
15
-LodelContext.expose_modules(globals(), {
16
-    'lodel.exceptions': [
17
-        'LodelException',
18
-        'LodelExceptions',
19
-        'LodelFatalError',
20
-        'DataNoneValid',
21
-        'FieldValidationError'
22
-    ],
23
-    'lodel.mlnamedobject.mlnamedobject': ['MlNamedObject'],
24
-    'lodel.leapi.datahandlers.exceptions': [
25
-        'LodelDataHandlerConsistencyException',
26
-        'LodelDataHandlerException'
27
-    ],
28
-    'lodel.validator.validator': [
29
-        'ValidationError'
30
-    ],
31
-    'lodel.logger': 'logger',
32
-    'lodel.utils.mlstring': ['MlString']})
13
+from lodel.exceptions import LodelException, LodelExceptions, LodelFatalError, DataNoneValid, FieldValidationError
14
+from lodel.mlnamedobject.mlnamedobject import MlNamedObject
15
+from lodel.leapi.datahandlers.exceptions import LodelDataHandlerConsistencyException, LodelDataHandlerException
16
+from lodel.validator.validator import ValidationError
17
+from lodel.logger import logger
18
+from lodel.utils.mlstring import MlString
33
 
19
 
34
 ##
20
 ##
35
 # @brief Base class for all DataHandlers
21
 # @brief Base class for all DataHandlers

+ 2
- 7
lodel/leapi/datahandlers/datas.py ファイルの表示

8
 import inspect
8
 import inspect
9
 import re
9
 import re
10
 
10
 
11
-from lodel.context import LodelContext
12
-
13
-LodelContext.expose_modules(globals(), {
14
-    'lodel.leapi.datahandlers.datas_base': ['Boolean', 'Integer', 'Varchar',
15
-                                            'DateTime', 'Text', 'File'],
16
-    'lodel.exceptions': ['LodelException', 'LodelExceptions',
17
-                         'LodelFatalError', 'DataNoneValid', 'FieldValidationError']})
11
+from lodel.leapi.datahandlers.datas_base import Boolean, Integer, Varchar, DateTime, Text, File
12
+from lodel.exceptions import LodelException, LodelExceptions, LodelFatalError, DataNoneValid, FieldValidationError
18
 
13
 
19
 
14
 
20
 ## @brief Data field designed to handle formated strings
15
 ## @brief Data field designed to handle formated strings

+ 2
- 7
lodel/leapi/datahandlers/datas_base.py ファイルの表示

3
 import datetime
3
 import datetime
4
 import time
4
 import time
5
 import os
5
 import os
6
-from lodel.context import LodelContext
7
-
8
-
9
-LodelContext.expose_modules(globals(), {
10
-    'lodel.leapi.datahandlers.base_classes': ['DataField'],
11
-    'lodel.exceptions': ['LodelException', 'LodelExceptions',
12
-                         'LodelFatalError', 'DataNoneValid', 'FieldValidationError']})
13
 
6
 
7
+from lodel.leapi.datahandlers.base_classes import DataField
8
+from lodel.exceptions import LodelException, LodelExceptions, LodelFatalError, DataNoneValid, FieldValidationError
14
 
9
 
15
 ##
10
 ##
16
 ## @brief Data field designed to handle boolean values
11
 ## @brief Data field designed to handle boolean values

+ 3
- 10
lodel/leapi/datahandlers/references.py ファイルの表示

1
-# -*- coding: utf-8 -*-
2
-
3
-from lodel.context import LodelContext
4
-LodelContext.expose_modules(globals(), {
5
-    'lodel.leapi.datahandlers.base_classes': ['Reference', 'MultipleRef',
6
-                                              'SingleRef'],
7
-    'lodel.logger': 'logger',
8
-    'lodel.exceptions': ['LodelException', 'LodelExceptions',
9
-                         'LodelFatalError', 'DataNoneValid',
10
-                         'FieldValidationError']})
1
+from lodel.leapi.datahandlers.base_classes import Reference, MultipleRef, SingleRef
2
+from lodel.logger import logger
3
+from lodel.exceptions import  LodelException, LodelExceptions, LodelFatalError, DataNoneValid, FieldValidationError
11
 
4
 
12
 ## @brief Child class of SingleRef. The object referenced must exist
5
 ## @brief Child class of SingleRef. The object referenced must exist
13
 class Link(SingleRef):
6
 class Link(SingleRef):

+ 2
- 3
lodel/leapi/exceptions.py ファイルの表示

1
 #-*- coding: utf-8 -*-
1
 #-*- coding: utf-8 -*-
2
 
2
 
3
-from lodel.context import LodelContext
4
-LodelContext.expose_modules(globals(), {
5
-    'lodel.exceptions': ['LodelExceptions', 'LodelException']})
3
+from lodel.exceptions import LodelExceptions, LodelException
4
+
6
 
5
 
7
 ##@brief Handles LeApi error
6
 ##@brief Handles LeApi error
8
 class LeApiError(LodelException):
7
 class LeApiError(LodelException):

+ 7
- 12
lodel/leapi/lefactory.py ファイルの表示

4
 import os.path
4
 import os.path
5
 import functools
5
 import functools
6
 
6
 
7
-from lodel.context import LodelContext
8
-LodelContext.expose_modules(globals(), {
9
-    'lodel.editorial_model.components': ['EmComponent', 'EmClass', 'EmField',
10
-                                         'EmGroup'],
11
-    'lodel.leapi.leobject': ['LeObject'],
12
-    'lodel.leapi.datahandlers.base_classes': ['DataHandler'],
13
-    'lodel.logger': 'logger'})
7
+from lodel.editorial_model.components import EmComponent, EmClass, EmField, EmGroup
8
+from lodel.leapi.leobject import LeObject
9
+from lodel.leapi.datahandlers.base_classes import DataHandler
10
+from lodel.logger import logger
14
 
11
 
15
 ## @brief Generates python module code from a given model
12
 ## @brief Generates python module code from a given model
16
 # @param model lodel.editorial_model.model.EditorialModel
13
 # @param model lodel.editorial_model.model.EditorialModel
22
     cls_code, bootstrap_instr = generate_classes(model)
19
     cls_code, bootstrap_instr = generate_classes(model)
23
 
20
 
24
     # Header
21
     # Header
25
-    imports = """from lodel.context import LodelContext
26
-LodelContext.expose_modules(globals(), {
27
-    'lodel.leapi.leobject': ['LeObject'],
28
-    'lodel.leapi.datahandlers.base_classes': ['DataField'],
29
-    'lodel.plugin.hooks': ['LodelHook']})
22
+    imports = """from lodel.leapi.leobject import LeObject
23
+    from lodel.leapi.datahandlers.base_classes import DataField
24
+    from lodel.plugin.hooksimport LodelHook
30
 """
25
 """
31
     # generates the list of all classes in the editorial model
26
     # generates the list of all classes in the editorial model
32
     class_list = [LeObject.name2objname(cls.uid) for cls in get_classes(model)]
27
     class_list = [LeObject.name2objname(cls.uid) for cls in get_classes(model)]

+ 1
- 1
lodel/leapi/lefactory_common.py ファイルの表示

31
 def lodel2_dyncode_datasources_init(self, caller, payload):
31
 def lodel2_dyncode_datasources_init(self, caller, payload):
32
     for cls in dynclasses:
32
     for cls in dynclasses:
33
         cls._init_datasources()
33
         cls._init_datasources()
34
-    LodelContext.expose_modules(globals(), {'lodel.plugin.hooks': ['LodelHook']})
34
+    from lodel.plugin.hooks import LodelHook
35
     LodelHook.call_hook("lodel2_dyncode_loaded", __name__, dynclasses)
35
     LodelHook.call_hook("lodel2_dyncode_loaded", __name__, dynclasses)

+ 11
- 17
lodel/leapi/leobject.py ファイルの表示

8
 import warnings
8
 import warnings
9
 import copy
9
 import copy
10
 
10
 
11
-from lodel.context import LodelContext
12
-
13
-LodelContext.expose_modules(globals(), {
14
-    'lodel.logger': 'logger',
15
-    'lodel.settings': 'Settings',
16
-    'lodel.settings.utils': 'SettingsError',
17
-    'lodel.leapi.query': ['LeInsertQuery', 'LeUpdateQuery', 'LeDeleteQuery',
18
-                          'LeGetQuery'],
19
-    'lodel.leapi.exceptions': ['LeApiError', 'LeApiErrors',
20
-                               'LeApiDataCheckError', 'LeApiDataCheckErrors', 'LeApiQueryError',
21
-                               'LeApiQueryErrors'],
22
-    'lodel.plugin.exceptions': ['PluginError', 'PluginTypeError',
23
-                                'LodelScriptError', 'DatasourcePluginError'],
24
-    'lodel.exceptions': ['LodelFatalError'],
25
-    'lodel.plugin.hooks': ['LodelHook'],
26
-    'lodel.plugin': ['Plugin', 'DatasourcePlugin'],
27
-    'lodel.leapi.datahandlers.base_classes': ['DatasConstructor', 'Reference']})
11
+from lodel.logger import logger
12
+from lodel.settings import Settings
13
+from lodel.settings.utils import SettingsError
14
+from lodel.leapi.query import LeInsertQuery, LeUpdateQuery, LeDeleteQuery, LeGetQuery
15
+from lodel.leapi.exceptions import LeApiError, LeApiErrors, LeApiDataCheckError, LeApiDataCheckErrors, LeApiQueryError, LeApiQueryErrors
16
+from lodel.plugin.exceptions import PluginError, PluginTypeError, LodelScriptError, DatasourcePluginError
17
+from lodel.exceptions import LodelFatalError
18
+from lodel.plugin.hooks import LodelHook
19
+from lodel.plugin import Plugin, DatasourcePlugin
20
+from lodel.leapi.datahandlers.base_classes import DatasConstructor, Reference
21
+
28
 
22
 
29
 ## @brief Stores the name of the field present in each LeObject that indicates the name of LeObject subclass represented by this object
23
 ## @brief Stores the name of the field present in each LeObject that indicates the name of LeObject subclass represented by this object
30
 CLASS_ID_FIELDNAME = "classname"
24
 CLASS_ID_FIELDNAME = "classname"

+ 3
- 7
lodel/leapi/query.py ファイルの表示

5
 import inspect
5
 import inspect
6
 import warnings
6
 import warnings
7
 
7
 
8
-from lodel.context import LodelContext
9
-LodelContext.expose_modules(globals(), {
10
-    'lodel.leapi.exceptions': ['LeApiError', 'LeApiErrors',
11
-                               'LeApiDataCheckError', 'LeApiDataCheckErrors', 'LeApiQueryError',
12
-                               'LeApiQueryErrors'],
13
-    'lodel.plugin.hooks': ['LodelHook'],
14
-    'lodel.logger': ['logger']})
8
+from lodel.leapi.exceptions import LeApiError, LeApiErrors, LeApiDataCheckError, LeApiDataCheckErrors, LeApiQueryError, LeApiQueryErrors
9
+from lodel.plugin.hooks import LodelHook
10
+from lodel.logger import logger
15
 
11
 
16
 # @todo check data when running query
12
 # @todo check data when running query
17
 
13
 

+ 2
- 8
lodel/logger.py ファイルの表示

20
 ##@brief Module initialisation from settings
20
 ##@brief Module initialisation from settings
21
 #@return True if inited else False
21
 #@return True if inited else False
22
 def __init_from_settings():
22
 def __init_from_settings():
23
-    from lodel.context import LodelContext
24
-    try:
25
-        LodelContext.expose_modules(globals(), {
26
-            'lodel.settings': ['Settings']})
27
-    except Exception:
28
-        return False
29
-    LodelContext.expose_modules(globals(), {
30
-        'lodel.settings.settings': [('Settings', 'Lodel2Settings')]})
23
+    from lodel.settings import Settings
24
+    from lodel.settings.settings import Settings, Lodel2Settings
31
     if not Lodel2Settings.started():
25
     if not Lodel2Settings.started():
32
         return False
26
         return False
33
     # capture warning disabled, because the custom format raises error (unable
27
     # capture warning disabled, because the custom format raises error (unable

+ 2
- 3
lodel/mlnamedobject/mlnamedobject.py ファイルの表示

1
 #-*- coding:utf-8 -*-
1
 #-*- coding:utf-8 -*-
2
 
2
 
3
-from lodel.context import LodelContext
4
-LodelContext.expose_modules(globals(), {
5
-    'lodel.utils.mlstring': ['MlString']})
3
+from lodel.utils.mlstring import MlString
4
+
6
 
5
 
7
 ## @package lodel.mlnamedobject.mlnamedobject Lodel2 description of objects module
6
 ## @package lodel.mlnamedobject.mlnamedobject Lodel2 description of objects module
8
 #
7
 #

+ 6
- 8
lodel/plugin/__init__.py ファイルの表示

91
 # - @ref lodel.plugin.interface.InterfacePlugin "InterfacePlugin"
91
 # - @ref lodel.plugin.interface.InterfacePlugin "InterfacePlugin"
92
 # - @ref lodel.plugin.sessionhandler.SessionHandlerPlugin "SessionHandlerPlugin"
92
 # - @ref lodel.plugin.sessionhandler.SessionHandlerPlugin "SessionHandlerPlugin"
93
 
93
 
94
-from lodel.context import LodelContext
95
-LodelContext.expose_modules(globals(), {
96
-    'lodel.plugin.hooks': ['LodelHook'],
97
-    'lodel.plugin.plugins': ['Plugin', 'CustomMethod'],
98
-    'lodel.plugin.datasource_plugin': ['DatasourcePlugin'],
99
-    'lodel.plugin.sessionhandler': ['SessionHandlerPlugin'],
100
-    'lodel.plugin.interface': ['InterfacePlugin'],
101
-    'lodel.plugin.extensions': ['Extension']})
94
+from lodel.plugin.hooks import LodelHook
95
+from lodel.plugin.plugins import Plugin, CustomMethod
96
+from lodel.plugin.datasource_plugin import DatasourcePlugin
97
+from lodel.plugin.sessionhandler SessionHandlerPlugin
98
+from lodel.plugin.interface import InterfacePlugin
99
+from lodel.plugin.extensions import Extension

+ 5
- 9
lodel/plugin/core_hooks.py ファイルの表示

1
 #-*- coding: utf-8 -*-
1
 #-*- coding: utf-8 -*-
2
 
2
 
3
-from lodel.context import LodelContext
4
-LodelContext.expose_modules(globals(), {
5
-    'lodel.plugin': ['LodelHook'],
6
-    'lodel.settings': ['Settings'],
7
-    'lodel.logger': 'logger'})
3
+from lodel.plugin import LodelHook
4
+from lodel.settings import Setting
5
+from lodel.logger import logger
8
 
6
 
9
 ## @package lodel.plugin.core_hooks
7
 ## @package lodel.plugin.core_hooks
10
 # @brief Lodel2 internal hooks declaration
8
 # @brief Lodel2 internal hooks declaration
46
 # @param payload * : data to be given to the hook
44
 # @param payload * : data to be given to the hook
47
 @LodelHook('lodel2_bootstraped')
45
 @LodelHook('lodel2_bootstraped')
48
 def list_hook_debug_hook(name, caller, payload):
46
 def list_hook_debug_hook(name, caller, payload):
49
-    LodelContext.expose_modules(globals(), {
50
-        'lodel.logger': 'logger'})
47
+    from lodel.logger import logger
51
     hlist = LodelHook.hook_list()
48
     hlist = LodelHook.hook_list()
52
     for name, reg_hooks in hlist.items():
49
     for name, reg_hooks in hlist.items():
53
         for hook, priority in reg_hooks:
50
         for hook, priority in reg_hooks:
66
 # @param dynclasses list : a list of classes in which the injection will occur
63
 # @param dynclasses list : a list of classes in which the injection will occur
67
 @LodelHook("lodel2_dyncode_loaded")
64
 @LodelHook("lodel2_dyncode_loaded")
68
 def lodel2_plugins_custom_methods(self, caller, dynclasses):
65
 def lodel2_plugins_custom_methods(self, caller, dynclasses):
69
-    LodelContext.expose_modules(globals(), {
70
-        'lodel.plugin.plugins': ['CustomMethod']})
66
+    from lodel.plugin.plugins import CustomMethod
71
     CustomMethod.set_registered(dynclasses)
67
     CustomMethod.set_registered(dynclasses)

+ 3
- 4
lodel/plugin/core_scripts.py ファイルの表示

4
 import os
4
 import os
5
 import os.path
5
 import os.path
6
 import argparse
6
 import argparse
7
-from lodel.context import LodelContext
8
-LodelContext.expose_modules(globals(), {
9
-    'lodel.plugin.scripts': 'lodel_script',
10
-    'lodel.logger': 'logger'})
7
+
8
+from lodel.plugin.scripts import lodel_script
9
+from lodel.logger import logger
11
 
10
 
12
 # @package lodel.plugin.core_scripts
11
 # @package lodel.plugin.core_scripts
13
 #@brief Lodel2 internal scripts declaration
12
 #@brief Lodel2 internal scripts declaration

+ 7
- 12
lodel/plugin/datasource_plugin.py ファイルの表示

3
 # It contains the base classes for all the datasource plugins that could be added to Lodel
3
 # It contains the base classes for all the datasource plugins that could be added to Lodel
4
 
4
 
5
 
5
 
6
-from lodel.context import LodelContext
7
-LodelContext.expose_modules(globals(), {
8
-    'lodel.plugin.plugins': ['Plugin'],
9
-    'lodel.plugin.exceptions': ['PluginError', 'PluginTypeError',
10
-        'LodelScriptError', 'DatasourcePluginError'],
11
-    'lodel.validator.validator': ['Validator'],
12
-    'lodel.exceptions': ['LodelException', 'LodelExceptions',
13
-        'LodelFatalError', 'DataNoneValid', 'FieldValidationError']})
6
+
7
+from lodel.plugin.plugins import Plugin
8
+from lodel.plugin.exceptions import PluginError, PluginTypeError, LodelScriptError, DatasourcePluginError 
9
+from lodel.validator.validator import Validator
10
+from lodel.exceptions import LodelException, LodelExceptions, LodelFatalError, DataNoneValid, FieldValidationError
14
 
11
 
15
 ## @brief The plugin type that is used in the global settings of Lodel
12
 ## @brief The plugin type that is used in the global settings of Lodel
16
 _glob_typename = 'datasource'
13
 _glob_typename = 'datasource'
172
     # @throw SettingsError if there are misconfigured datasource settings.
169
     # @throw SettingsError if there are misconfigured datasource settings.
173
     @staticmethod
170
     @staticmethod
174
     def plugin_name(ds_name, ro):
171
     def plugin_name(ds_name, ro):
175
-        LodelContext.expose_modules(globals(), {
176
-            'lodel.settings': ['Settings']})
172
+        from lodel.settings import Settings
177
         # fetching connection identifier given datasource name
173
         # fetching connection identifier given datasource name
178
         try:
174
         try:
179
             ds_identifier = getattr(Settings.datasources, ds_name)
175
             ds_identifier = getattr(Settings.datasources, ds_name)
209
     # @throw DatasourcePluginError if a datasource plugin or instance cannot be found
205
     # @throw DatasourcePluginError if a datasource plugin or instance cannot be found
210
     @staticmethod
206
     @staticmethod
211
     def _get_ds_connection_conf(ds_identifier,ds_plugin_name):
207
     def _get_ds_connection_conf(ds_identifier,ds_plugin_name):
212
-        LodelContext.expose_modules(globals(), {
213
-            'lodel.settings': ['Settings']})
208
+        from lodel.settings import Settings
214
         if ds_plugin_name not in Settings.datasource._fields:
209
         if ds_plugin_name not in Settings.datasource._fields:
215
             msg = "Unknown or unconfigured datasource plugin %s"
210
             msg = "Unknown or unconfigured datasource plugin %s"
216
             msg %= ds_plugin_name
211
             msg %= ds_plugin_name

+ 3
- 6
lodel/plugin/extensions.py ファイルの表示

1
 ## @package lodel.plugin.extensions A package to manage the Extension plugins
1
 ## @package lodel.plugin.extensions A package to manage the Extension plugins
2
 
2
 
3
 
3
 
4
-from lodel.context import LodelContext
5
-LodelContext.expose_modules(globals(), {
6
-    'lodel.plugin.plugins': ['Plugin'],
7
-    'lodel.plugin.exceptions': ['PluginError', 'PluginTypeError',
8
-        'LodelScriptError', 'DatasourcePluginError'],
9
-    'lodel.validator.validator': ['Validator']})
4
+from lodel.plugin.plugins import Plugin
5
+from lodel.plugin.exceptions import PluginError, PluginTypeError, LodelScriptError, DatasourcePluginError
6
+from lodel.validator.validator import Validator
10
 
7
 
11
 _glob_typename = 'extension'
8
 _glob_typename = 'extension'
12
 
9
 

+ 1
- 3
lodel/plugin/hooks.py ファイルの表示

4
 
4
 
5
 import os
5
 import os
6
 import copy
6
 import copy
7
-from lodel.context import LodelContext
8
-
9
 
7
 
10
 ## @brief Class designed to handle a hook's callback with a priority
8
 ## @brief Class designed to handle a hook's callback with a priority
11
 class DecoratedWrapper(object):
9
 class DecoratedWrapper(object):
67
     # @return modified payload
65
     # @return modified payload
68
     @classmethod
66
     @classmethod
69
     def call_hook(cls, hook_name, caller, payload):
67
     def call_hook(cls, hook_name, caller, payload):
70
-        LodelContext.expose_modules(globals(), {'lodel.logger': 'logger'})
68
+        from lodel.logger import logger
71
         logger.debug("Calling hook '%s'" % hook_name)
69
         logger.debug("Calling hook '%s'" % hook_name)
72
         if hook_name in cls._hooks:
70
         if hook_name in cls._hooks:
73
             for hook in cls._hooks[hook_name]:
71
             for hook in cls._hooks[hook_name]:

+ 4
- 6
lodel/plugin/interface.py ファイルの表示

1
 ## @package lodel.plugin.interface Handles the Interface type plugins
1
 ## @package lodel.plugin.interface Handles the Interface type plugins
2
 
2
 
3
-from lodel.context import LodelContext
4
-LodelContext.expose_modules(globals(), {
5
-    'lodel.plugin.plugins': ['Plugin'],
6
-    'lodel.plugin.exceptions': ['PluginError', 'PluginTypeError',
7
-        'LodelScriptError', 'DatasourcePluginError'],
8
-    'lodel.validator.validator': ['Validator']})
3
+from lodel.plugin.plugins import Plugin
4
+from lodel.plugin.exceptions import PluginError, PluginTypeError, LodelScriptError, DatasourcePluginError
5
+from lodel.validator.validator import Validator
6
+
9
 
7
 
10
 ## @brief Global type name used in the settings of Lodel for this type of plugins
8
 ## @brief Global type name used in the settings of Lodel for this type of plugins
11
 _glob_typename = 'ui'
9
 _glob_typename = 'ui'

+ 9
- 18
lodel/plugin/plugins.py ファイルの表示

7
 import json
7
 import json
8
 from importlib.machinery import SourceFileLoader
8
 from importlib.machinery import SourceFileLoader
9
 
9
 
10
-from lodel.context import LodelContext
11
-LodelContext.expose_modules(globals(), {
12
-    'lodel.logger': 'logger',
13
-    'lodel.settings.utils': ['SettingsError'],
14
-    'lodel.plugin.hooks': ['LodelHook'],
15
-    'lodel.plugin.exceptions': ['PluginError', 'PluginVersionError',
16
-                                'PluginTypeError', 'LodelScriptError', 'DatasourcePluginError'],
17
-    'lodel.exceptions': ['LodelException', 'LodelExceptions',
18
-                         'LodelFatalError', 'DataNoneValid', 'FieldValidationError']})
10
+from lodel.logger import logger
11
+from lodel.settings.utils import SettingsError
12
+from lodel.plugin.hooks import LodelHook
13
+from lodel.plugin.exceptions import PluginError, PluginVersionError, PluginTypeError, LodelScriptError, DatasourcePluginError
14
+from lodel.exceptions import LodelException, LodelExceptions, LodelFatalError, DataNoneValid, FieldValidationError
15
+
19
 
16
 
20
 ##  @package lodel.plugins Lodel2 plugins management
17
 ##  @package lodel.plugins Lodel2 plugins management
21
 #@ingroup lodel2_plugins
18
 #@ingroup lodel2_plugins
54
 PLUGIN_DEPS_VARNAME = '__plugin_deps__'
51
 PLUGIN_DEPS_VARNAME = '__plugin_deps__'
55
 ## @brief Name of the optional activate method
52
 ## @brief Name of the optional activate method
56
 ACTIVATE_METHOD_NAME = '_activate'
53
 ACTIVATE_METHOD_NAME = '_activate'
57
-## @brief Default & failover value for plugins path list
58
-PLUGINS_PATH = os.path.join(LodelContext.context_dir(), 'plugins')
59
 
54
 
60
 ## @brief List storing the mandatory variables expected in a plugin __init__.py
55
 ## @brief List storing the mandatory variables expected in a plugin __init__.py
61
 # file
56
 # file
316
 
311
 
317
         # Importing __init__.py infos in it
312
         # Importing __init__.py infos in it
318
         plugin_module = self.module_name()
313
         plugin_module = self.module_name()
319
-        self.module = LodelContext.module(plugin_module)
314
+        self.module = LodelContext.module(plugin_module) # To be modified without LodelContext, i let it to raise an error and remember
320
 
315
 
321
         # loading confspecs
316
         # loading confspecs
322
         try:
317
         try:
579
     # etc...
574
     # etc...
580
     @classmethod
575
     @classmethod
581
     def plugin_list_confspec(cls):
576
     def plugin_list_confspec(cls):
582
-        LodelContext.expose_modules(globals(), {
583
-            'lodel.settings.validator': ['confspec_append']})
577
+        from lodel.settings.validator import confspec_append
584
         res = dict()
578
         res = dict()
585
         for pcls in cls.plugin_types():
579
         for pcls in cls.plugin_types():
586
             plcs = pcls.plist_confspec()
580
             plcs = pcls.plist_confspec()
779
     ## @brief Import init file from a plugin path
773
     ## @brief Import init file from a plugin path
780
     #@param path str : Directory path
774
     #@param path str : Directory path
781
     #@return a tuple (init_module, module_name)
775
     #@return a tuple (init_module, module_name)
782
-    #@todo replace by LodelContext usage !!! (not mandatory, this fun
783
-    # is only used in plugin discover method)
784
     @classmethod
776
     @classmethod
785
     def import_init(cls, path):
777
     def import_init(cls, path):
786
         cls._mod_cnt += 1  # in order to ensure module name unicity
778
         cls._mod_cnt += 1  # in order to ensure module name unicity
812
     @classmethod
804
     @classmethod
813
     def _discover(cls, path):
805
     def _discover(cls, path):
814
         # Ensure plugins symlink creation
806
         # Ensure plugins symlink creation
815
-        LodelContext.expose_modules(globals(), {
816
-            'lodel.plugins': 'plugins'})
807
+        from lodel.plugins import plugins
817
         res = []
808
         res = []
818
         to_explore = [path]
809
         to_explore = [path]
819
         while len(to_explore) > 0:
810
         while len(to_explore) > 0:

+ 3
- 5
lodel/plugin/scripts.py ファイルの表示

1
 import argparse
1
 import argparse
2
 import sys
2
 import sys
3
 
3
 
4
-from lodel.context import LodelContext
5
-LodelContext.expose_modules(globals(), {
6
-    'lodel.logger': 'logger',
7
-    'lodel.exceptions': ['LodelException', 'LodelExceptions',
8
-        'LodelFatalError', 'DataNoneValid', 'FieldValidationError']})
4
+from lodel.logger import logger
5
+from lodel.exceptions import LodelException, LodelExceptions, LodelFatalError, DataNoneValid, FieldValidationError
6
+
9
 
7
 
10
 ## @defgroup lodel2_script Administration scripts
8
 ## @defgroup lodel2_script Administration scripts
11
 # @ingroup lodel2_plugins
9
 # @ingroup lodel2_plugins

+ 3
- 6
lodel/plugin/sessionhandler.py ファイルの表示

1
-from lodel.context import LodelContext
2
-LodelContext.expose_modules(globals(), {
3
-    'lodel.plugin.plugins': ['Plugin', 'MetaPlugType'],
4
-    'lodel.plugin.exceptions': ['PluginError', 'PluginTypeError',
5
-        'LodelScriptError', 'DatasourcePluginError'],
6
-    'lodel.validator.validator': ['Validator']})
1
+from lodel.plugin.plugins import Plugin, MetaPlugType
2
+from lodel.plugin.exceptions import PluginError, PluginTypeError, LodelScriptError, DatasourcePluginError
3
+from lodel.validator.validator import Validator
7
 
4
 
8
 
5
 
9
 ##@brief SessionHandlerPlugin metaclass designed to implements a wrapper
6
 ##@brief SessionHandlerPlugin metaclass designed to implements a wrapper

+ 1
- 3
lodel/plugins/dummy/__init__.py ファイルの表示

1
 ## @package lodel.plugins.dummy Basic plugin used as a template for developping new plugins
1
 ## @package lodel.plugins.dummy Basic plugin used as a template for developping new plugins
2
 
2
 
3
-from lodel.context import LodelContext
4
-LodelContext.expose_modules(globals(), {
5
-    'lodel.validator.validator': ['Validator']})
3
+from lodel.validator.validator import Validator
6
 
4
 
7
 ## @brief plugin's name (matching the package's name)
5
 ## @brief plugin's name (matching the package's name)
8
 __plugin_name__ = "dummy"
6
 __plugin_name__ = "dummy"

+ 1
- 3
lodel/plugins/dummy/confspec.py ファイルの表示

2
 
2
 
3
 ## @package lodel.plugins.dummy.confspec The module that defines the plugin's configuration options
3
 ## @package lodel.plugins.dummy.confspec The module that defines the plugin's configuration options
4
 
4
 
5
-from lodel.context import LodelContext
6
-LodelContext.expose_modules(globals(), {
7
-    'lodel.validator.validator': ['Validator']})
5
+from lodel.validator.validator import Validator
8
 
6
 
9
 ## @brief Dictionary defining the plugin's configuration options and their validators
7
 ## @brief Dictionary defining the plugin's configuration options and their validators
10
 CONFSPEC = {
8
 CONFSPEC = {

+ 2
- 4
lodel/plugins/dummy/main.py ファイルの表示

2
 
2
 
3
 ## @package lodel.plugins.dummy.main Plugin's loader module
3
 ## @package lodel.plugins.dummy.main Plugin's loader module
4
 
4
 
5
-from lodel.context import LodelContext
6
-LodelContext.expose_modules(globals(), {
7
-    'lodel.plugin': ['LodelHook', 'CustomMethod'],
8
-    'lodel.settings' : 'settings'})
5
+from lodel.plugin import LodelHook, CustomMethod,
6
+from lodel.settings import settings
9
 
7
 
10
 
8
 
11
 ## @brief callback method using lodel's hook system
9
 ## @brief callback method using lodel's hook system

+ 1
- 3
lodel/plugins/dummy_datasource/__init__.py ファイルの表示

1
 ## @package lodel.plugins.dummy_datasource Example of a datasource type plugin
1
 ## @package lodel.plugins.dummy_datasource Example of a datasource type plugin
2
 
2
 
3
 # Here we use the Lodel Context Manager to expose the modules which are specific to the application
3
 # Here we use the Lodel Context Manager to expose the modules which are specific to the application
4
-from lodel.context import LodelContext
5
-LodelContext.expose_modules(globals(), {
6
-    'lodel.validator.validator': ['Validator']})
4
+from lodel.validator.validator import Validator
7
 from .datasource import DummyDatasource as Datasource
5
 from .datasource import DummyDatasource as Datasource
8
 
6
 
9
 ## @brief plugin's category
7
 ## @brief plugin's category

+ 1
- 3
lodel/plugins/dummy_datasource/datasource.py ファイルの表示

2
 
2
 
3
 ## @package lodel.plugins.dummy_datasource.datasource This module contains the main class of the datasource, implementing the basic operations one can perform.
3
 ## @package lodel.plugins.dummy_datasource.datasource This module contains the main class of the datasource, implementing the basic operations one can perform.
4
 
4
 
5
-from lodel.context import LodelContext
6
-LodelContext.expose_modules(globals(), {
7
-    'lodel.plugin.datasource_plugin': ['AbstractDatasource']})
5
+from lodel.plugin.datasource_plugin import AbstractDatasource
8
 
6
 
9
 ## @brief Datasource class, inherited from @ref lodel.plugin.datasource.AbstractDatasource
7
 ## @brief Datasource class, inherited from @ref lodel.plugin.datasource.AbstractDatasource
10
 class DummyDatasource(AbstractDatasource):
8
 class DummyDatasource(AbstractDatasource):

+ 1
- 3
lodel/plugins/dummy_datasource/main.py ファイルの表示

2
 
2
 
3
 ## @package lodel.plugins.dummy_datasource.main The main module of the plugin. 
3
 ## @package lodel.plugins.dummy_datasource.main The main module of the plugin. 
4
 
4
 
5
-from lodel.context import LodelContext
6
-LodelContext.expose_modules(globals(), {
7
-    'lodel.plugin': ['LodelHook']})
5
+from lodel.plugin import LodelHook
8
 from .datasource import DummyDatasource as Datasource
6
 from .datasource import DummyDatasource as Datasource
9
 
7
 
10
 ## @brief returns the migration handler of this plugin. 
8
 ## @brief returns the migration handler of this plugin. 

+ 0
- 2
lodel/plugins/dummy_datasource/migration_handler.py ファイルの表示

1
-#-*- coding: utf-8 -*-
2
-
3
 ## @package lodel.plugins.dummy_datasource.migration_handler Migration handler of the datasource plugin. 
1
 ## @package lodel.plugins.dummy_datasource.migration_handler Migration handler of the datasource plugin. 
4
 #
2
 #
5
 # The migration handler is here to report the changes made in the editorial model to the data source. 
3
 # The migration handler is here to report the changes made in the editorial model to the data source. 

+ 1
- 3
lodel/plugins/filesystem_session/__init__.py ファイルの表示

1
 ## @package plugins.filesystem_session This package is a plugin for filesystem based session management
1
 ## @package plugins.filesystem_session This package is a plugin for filesystem based session management
2
 
2
 
3
-from lodel.context import LodelContext
4
-LodelContext.expose_modules(globals(), {
5
-    'lodel.validator.validator': ['Validator']})
3
+from lodel.validator.validator import Validator
6
 
4
 
7
 __plugin_name__ = 'filesystem_session'
5
 __plugin_name__ = 'filesystem_session'
8
 __version__ = [0,0,1]
6
 __version__ = [0,0,1]

+ 1
- 3
lodel/plugins/filesystem_session/confspec.py ファイルの表示

2
 
2
 
3
 ## @package lodel.plugins.filesystem_session.confspec A module that defines the configuration options available for that plugin
3
 ## @package lodel.plugins.filesystem_session.confspec A module that defines the configuration options available for that plugin
4
 
4
 
5
-from lodel.context import LodelContext
6
-LodelContext.expose_modules(globals(), {
7
-    'lodel.validator.validator': ['Validator']})
5
+from lodel.validator.validator import Validator
8
 
6
 
9
 ## @brief Dictionary of the options and their corresponding validators
7
 ## @brief Dictionary of the options and their corresponding validators
10
 CONFSPEC = {
8
 CONFSPEC = {

+ 3
- 6
lodel/plugins/filesystem_session/main.py ファイルの表示

9
 import re
9
 import re
10
 import time
10
 import time
11
 from .filesystem_session import FileSystemSession
11
 from .filesystem_session import FileSystemSession
12
-from lodel.context import LodelContext
13
 
12
 
14
-
15
-LodelContext.expose_modules(globals(), {
16
-    'lodel.logger': 'logger',
17
-    'lodel.auth.exceptions': ['ClientAuthenticationFailure'],
18
-    'lodel.settings': ['Settings']})
13
+from lodel.logger import logger
14
+from lodel.auth.exceptions import ClientAuthenticationFailure,
15
+from lodel.settings import Settings
19
 
16
 
20
 __sessions = dict()
17
 __sessions = dict()
21
 
18
 

+ 1
- 5
lodel/plugins/mongodb_datasource/confspec.py ファイルの表示

1
-# -*- coding: utf-8 -*-
2
-
3
-from lodel.context import LodelContext
4
-LodelContext.expose_modules(globals(), {
5
-    'lodel.validator.validator': ['Validator']})
1
+from lodel.validator.validator import Validator
6
 
2
 
7
 ## @brief Mongodb datasource plugin confspec
3
 ## @brief Mongodb datasource plugin confspec
8
 # @ingroup plugin_mongodb_datasource
4
 # @ingroup plugin_mongodb_datasource

+ 5
- 7
lodel/plugins/mongodb_datasource/datasource.py ファイルの表示

14
 import pymongo
14
 import pymongo
15
 from pymongo.errors import BulkWriteError
15
 from pymongo.errors import BulkWriteError
16
 
16
 
17
-from lodel.context import LodelContext
18
-LodelContext.expose_modules(globals(), {
19
-    'lodel.logger': 'logger',
20
-    'lodel.leapi.leobject': ['CLASS_ID_FIELDNAME'],
21
-    'lodel.leapi.datahandlers.base_classes': ['Reference', 'MultipleRef'],
22
-    'lodel.exceptions': ['LodelException', 'LodelFatalError'],
23
-    'lodel.plugin.datasource_plugin': ['AbstractDatasource']})
17
+from lodel.logger import logger
18
+from lodel.leapi.leobject import CLASS_ID_FIELDNAME
19
+from lodel.leapi.datahandlers.base_classes import Reference, MultipleRef
20
+from lodel.exceptions import LodelException, LodelFatalError
21
+from lodel.plugin.datasource_plugin import AbstractDatasource
24
 
22
 
25
 from . import utils
23
 from . import utils
26
 from .exceptions import *
24
 from .exceptions import *

+ 1
- 4
lodel/plugins/mongodb_datasource/exceptions.py ファイルの表示

1
-from lodel.context import LodelContext
2
-LodelContext.expose_modules(globals(), {
3
-    'lodel.exceptions': ['LodelException', 'LodelExceptions',
4
-        'LodelFatalError', 'DataNoneValid', 'FieldValidationError']})
1
+from lodel.exceptions import LodelException, LodelExceptions, LodelFatalError, DataNoneValid, FieldValidationError
5
 
2
 
6
 #@ingroup plugin_mongodb_datasource
3
 #@ingroup plugin_mongodb_datasource
7
 class MongoDbDataSourceError(Exception):
4
 class MongoDbDataSourceError(Exception):

+ 1
- 3
lodel/plugins/mongodb_datasource/main.py ファイルの表示

1
-from lodel.context import LodelContext
2
-LodelContext.expose_modules(globals(), {
3
-    'lodel.plugin': ['LodelHook']})
1
+from lodel.plugin import LodelHook
4
 
2
 
5
 from .datasource import MongoDbDatasource as Datasource
3
 from .datasource import MongoDbDatasource as Datasource
6
 
4
 

+ 5
- 7
lodel/plugins/mongodb_datasource/migration_handler.py ファイルの表示

1
 # -*- coding: utf-8 -*-
1
 # -*- coding: utf-8 -*-
2
 import datetime
2
 import datetime
3
 
3
 
4
-from lodel.context import LodelContext
5
-LodelContext.expose_modules(globals(), {
6
-    'lodel.editorial_model.components': ['EmClass', 'EmField'],
7
-    'lodel.editorial_model.model': ['EditorialModel'],
8
-    'lodel.leapi.datahandlers.base_classes': ['DataHandler'],
9
-    'lodel.plugin': ['LodelHook'],
10
-    'lodel.logger': 'logger'})
4
+from lodel.editorial_model.components import EmClass, EmField
5
+from lodel.editorial_model.model import EditorialModel
6
+from lodel.leapi.datahandlers.base_classes import DataHandler
7
+from lodel.plugin import LodelHook
8
+from lodel.logger import logger
11
 
9
 
12
 from leapi_dyncode import * #<-- TODO : handle this !!!
10
 from leapi_dyncode import * #<-- TODO : handle this !!!
13
 
11
 

+ 2
- 4
lodel/plugins/mongodb_datasource/utils.py ファイルの表示

3
 import pymongo
3
 import pymongo
4
 from pymongo import MongoClient
4
 from pymongo import MongoClient
5
 
5
 
6
-from lodel.context import LodelContext
7
-LodelContext.expose_modules(globals(), {
8
-    'lodel.settings.settings': [('Settings', 'settings')],
9
-    'lodel.logger': 'logger'})
6
+from lodel.settings.settings import Settings, settings
7
+from lodel.logger logger
10
 
8
 
11
 common_collections = {
9
 common_collections = {
12
     'object': 'objects',
10
     'object': 'objects',

+ 1
- 4
lodel/plugins/multisite/__init__.py ファイルの表示

1
-from lodel.context import LodelContext, ContextError
1
+from lodel.validator.validator import Validator
2
 try:
2
 try:
3
-    LodelContext.expose_modules(globals(), {
4
-        'lodel.validator.validator': ['Validator']})
5
-
6
     __plugin_name__ = "multisite"
3
     __plugin_name__ = "multisite"
7
     __version__ = '0.0.1' #or __version__ = [0,0,1]
4
     __version__ = '0.0.1' #or __version__ = [0,0,1]
8
     __loader__ = "main.py"
5
     __loader__ = "main.py"

+ 1
- 3
lodel/plugins/multisite/confspecs.py ファイルの表示

1
-from lodel.context import LodelContext
2
-LodelContext.expose_modules(globals(), {
3
-    'lodel.validator.validator': ['Validator']})
1
+from lodel.validator.validator import Validator
4
 
2
 
5
 #Define a minimal confspec used by multisite loader
3
 #Define a minimal confspec used by multisite loader
6
 LODEL2_CONFSPECS = {
4
 LODEL2_CONFSPECS = {

+ 5
- 13
lodel/plugins/multisite/loader.py ファイルの表示

9
 #
9
 #
10
 #This file (once bootstraped) start a new process for uWSGI. uWSGI then
10
 #This file (once bootstraped) start a new process for uWSGI. uWSGI then
11
 #run lodel.plugins.multisite.run.application function
11
 #run lodel.plugins.multisite.run.application function
12
-try:
13
-    from lodel.context import LodelContext
14
-except ImportError:
15
-    LODEL_BASE_DIR = os.path.dirname(
16
-        os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
17
-    from lodel.context import LodelContext
18
 
12
 
19
 from lodel import buildconf
13
 from lodel import buildconf
20
 
14
 
21
-LodelContext.init(LodelContext.MULTISITE)
22
-LodelContext.set(None) #Loading context creation
23
 #Multisite instance settings loading
15
 #Multisite instance settings loading
24
 CONFDIR = os.path.join(os.getcwd(), 'conf.d')
16
 CONFDIR = os.path.join(os.getcwd(), 'conf.d')
25
 if not os.path.isdir(CONFDIR):
17
 if not os.path.isdir(CONFDIR):
26
     warnings.warn('%s do not exists, default settings used' % CONFDIR)
18
     warnings.warn('%s do not exists, default settings used' % CONFDIR)
27
-LodelContext.expose_modules(globals(), {
28
-    'lodel.settings.settings': [('Settings', 'settings')],
29
-    'lodel.plugins.multisite.confspecs': 'multisite_confspecs'})
19
+    
20
+from lodel.settings.settings import Settings,settings
21
+from lodel.plugins.multisite.confspecs import multisite_confspecs
22
+
30
 if not settings.started():
23
 if not settings.started():
31
     settings('./conf.d', multisite_confspecs.LODEL2_CONFSPECS)
24
     settings('./conf.d', multisite_confspecs.LODEL2_CONFSPECS)
32
 
25
 
33
-LodelContext.expose_modules(globals(), {
34
-    'lodel.settings': ['Settings']})
26
+from lodel.settings import Settings
35
 
27
 
36
 ##@brief Starts uwsgi in background using settings
28
 ##@brief Starts uwsgi in background using settings
37
 def uwsgi_fork():
29
 def uwsgi_fork():

+ 11
- 16
lodel/plugins/multisite/run.py ファイルの表示

27
 CONFDIR = os.path.join(os.getcwd(), 'conf.d')
27
 CONFDIR = os.path.join(os.getcwd(), 'conf.d')
28
 if not os.path.isdir(CONFDIR):
28
 if not os.path.isdir(CONFDIR):
29
     warnings.warn('%s do not exists, default settings used' % CONFDIR)
29
     warnings.warn('%s do not exists, default settings used' % CONFDIR)
30
-LodelContext.expose_modules(globals(), {
31
-    'lodel.settings.settings': [('Settings', 'settings')],
32
-    'lodel.plugins.multisite.confspecs': 'multisite_confspecs'})
30
+from lodel.settings.settings import Settings, settings
31
+from lodel.plugins.multisite.confspecs import multisite_confspecs
32
+
33
 if not settings.started():
33
 if not settings.started():
34
     settings('./conf.d', multisite_confspecs.LODEL2_CONFSPECS)
34
     settings('./conf.d', multisite_confspecs.LODEL2_CONFSPECS)
35
 
35
 
45
     LodelContext.set(ctx_name)
45
     LodelContext.set(ctx_name)
46
     os.chdir(lodelsite_path)
46
     os.chdir(lodelsite_path)
47
     # Loading settings
47
     # Loading settings
48
-    LodelContext.expose_modules(globals(), {
49
-        'lodel.settings.settings': [('Settings', 'settings')]})
48
+    from lodel.settings.settings import Settings, settings
50
     if not settings.started():
49
     if not settings.started():
51
         settings('./conf.d')
50
         settings('./conf.d')
52
-    LodelContext.expose_modules(globals(), {'lodel.settings': ['Settings']})
51
+    from lodel.settings import Settings
53
 
52
 
54
     # Loading hooks & plugins
53
     # Loading hooks & plugins
55
-    LodelContext.expose_modules(globals(), {
56
-        'lodel.plugin': ['LodelHook'],
57
-        'lodel.plugin.core_hooks': 'core_hooks',
58
-        'lodel.plugin.core_scripts': 'core_scripts'
54
+    from lodel.plugin import LodelHook
55
+    from lodel.plugin.core_hooks import core_hooks
56
+    from lodel.plugin.core_scripts import core_scripts
59
     })
57
     })
60
 
58
 
61
     #Load plugins
59
     #Load plugins
62
-    LodelContext.expose_modules(globals(), {
63
-        'lodel.logger': 'logger',
64
-        'lodel.plugin': ['Plugin']})
60
+    from lodel.logger import logger
61
+    from lodel.plugin import Plugin
65
     logger.debug("Loader.start() called")
62
     logger.debug("Loader.start() called")
66
     Plugin.load_all()
63
     Plugin.load_all()
67
     #Import & expose dyncode
64
     #Import & expose dyncode
127
             "No site named '%s'" % site_id)
124
             "No site named '%s'" % site_id)
128
     #Calling webui
125
     #Calling webui
129
     return FAST_APP_EXPOSAL_CACHE[site_id].application(env, start_response)
126
     return FAST_APP_EXPOSAL_CACHE[site_id].application(env, start_response)
130
-    #LodelContext.expose_modules(globals(), {
131
-    #    'lodel.plugins.webui.run': ['application']})
132
-    #return application(env, start_response)
127
+
133
 
128
 

+ 1
- 3
lodel/plugins/ram_sessions/__init__.py ファイルの表示

1
-from lodel.context import LodelContext
2
-LodelContext.expose_modules(globals(), {
3
-    'lodel.validator.validator': ['Validator']})
1
+from lodel.validator.validator Validator
4
 
2
 
5
 __plugin_name__ = 'ram_sessions'
3
 __plugin_name__ = 'ram_sessions'
6
 __version__ = [0,0,1]
4
 __version__ = [0,0,1]

+ 3
- 6
lodel/plugins/ram_sessions/main.py ファイルの表示

3
 import copy
3
 import copy
4
 import binascii
4
 import binascii
5
 
5
 
6
-from lodel.context import LodelContext
7
-LodelContext.expose_modules(globals(), {
8
-    'lodel.logger': 'logger',
9
-    'lodel.settings': ['Settings'],
10
-    'lodel.auth.exceptions': ['ClientError', 'ClientAuthenticationFailure',
11
-        'ClientPermissionDenied', 'ClientAuthenticationError']})
6
+from lodel.logger import logger
7
+from lodel.settings import Settings
8
+from lodel.auth.exceptions import ClientError, ClientAuthenticationFailure, ClientPermissionDenied, ClientAuthenticationError
12
 
9
 
13
 __sessions = dict()
10
 __sessions = dict()
14
 
11
 

+ 1
- 2
lodel/plugins/webui/client.py ファイルの表示

1
-from lodel.context import LodelContext
2
-LodelContext.expose_modules(globals(), {'lodel.auth.client': ['Client']})
1
+from lodel.auth.client import Client
3
 
2
 
4
 class WebUiClient(Client):
3
 class WebUiClient(Client):
5
     
4
     

+ 1
- 3
lodel/plugins/webui/confspec.py ファイルの表示

1
-from lodel.context import LodelContext
2
-LodelContext.expose_modules(globals(), {
3
-    'lodel.validator.validator': ['Validator']})
1
+from lodel.validator.validator import Validator
4
 
2
 
5
 CONFSPEC = {
3
 CONFSPEC = {
6
     'lodel2.webui': {
4
     'lodel2.webui': {

+ 1
- 4
lodel/plugins/webui/exceptions.py ファイルの表示

1
-#-*- coding: utf-8 -*-
2
-
3
 from werkzeug.wrappers import Response
1
 from werkzeug.wrappers import Response
4
-from lodel.context import LodelContext
5
 
2
 
6
 class HttpException(Exception):
3
 class HttpException(Exception):
7
 
4
 
27
     
24
     
28
     ##@brief Log exception with lodel logger
25
     ##@brief Log exception with lodel logger
29
     def log(self):
26
     def log(self):
30
-        LodelContext.expose_modules(globals(), {'lodel.logger': 'logger'})
27
+        from lodel.logger import logger
31
         msg = "Webui HTTP exception : %s" % self
28
         msg = "Webui HTTP exception : %s" % self
32
         if self.status_code / 100 == 4:
29
         if self.status_code / 100 == 4:
33
             logger.security(msg)
30
             logger.security(msg)

+ 6
- 7
lodel/plugins/webui/interface/controllers/admin.py ファイルの表示

2
 from ...exceptions import *
2
 from ...exceptions import *
3
 from .base import get_response
3
 from .base import get_response
4
 
4
 
5
-from lodel.context import LodelContext
6
-LodelContext.expose_modules(globals(), {
7
-    'lodel.leapi.exceptions': [],
8
-    'lodel.logger': 'logger',
9
-    'lodel.leapi.datahandlers.base_classes': ['MultipleRef'],
10
-    'lodel.leapi.exceptions': ['LeApiDataCheckErrors'],
11
-    'lodel.exceptions': ['LodelExceptions']})
5
+import lodel.leapi.exceptions
6
+from lodel.logger import logger
7
+from lodel.leapi.datahandlers.base_classes import MultipleRef
8
+from lodel.leapi.exceptions import LeApiDataCheckErrors
9
+from lodel.exceptions import LodelExceptions
10
+
12
 LodelContext.expose_dyncode(globals(), 'dyncode')
11
 LodelContext.expose_dyncode(globals(), 'dyncode')
13
 
12
 
14
 from ...client import WebUiClient
13
 from ...client import WebUiClient

+ 2
- 2
lodel/plugins/webui/interface/controllers/listing.py ファイルの表示

1
 # -*- coding: utf-8 -*-
1
 # -*- coding: utf-8 -*-
2
-from lodel.context import LodelContext
3
-LodelContext.expose_modules(globals(), {'lodel.logger': 'logger'})
2
+from lodel.logger import logger
3
+
4
 LodelContext.expose_dyncode(globals(), 'dyncode')
4
 LodelContext.expose_dyncode(globals(), 'dyncode')
5
 
5
 
6
 from .base import get_response
6
 from .base import get_response

+ 2
- 2
lodel/plugins/webui/interface/controllers/users.py ファイルの表示

3
 from ...exceptions import *
3
 from ...exceptions import *
4
 from ...client import WebUiClient as WebUiClient
4
 from ...client import WebUiClient as WebUiClient
5
 
5
 
6
-from lodel.context import LodelContext
7
-LodelContext.expose_modules(globals(), {'lodel.logger': 'logger'})
6
+from lodel.logger import logger
7
+
8
 LodelContext.expose_dyncode(globals(), 'dyncode')
8
 LodelContext.expose_dyncode(globals(), 'dyncode')
9
 
9
 
10
 ##@brief These functions are called by the rules defined in ../urls.py
10
 ##@brief These functions are called by the rules defined in ../urls.py

+ 1
- 3
lodel/plugins/webui/interface/router.py ファイルの表示

5
 from .urls import urls
5
 from .urls import urls
6
 from ..main import root_url
6
 from ..main import root_url
7
 
7
 
8
-from lodel.context import LodelContext
9
-LodelContext.expose_modules(globals(), {
10
-    'lodel.settings': ['Settings']})
8
+from lodel.settings import Settings
11
 
9
 
12
 def format_url_rule(url_rule):
10
 def format_url_rule(url_rule):
13
     if url_rule.startswith('^'):
11
     if url_rule.startswith('^'):

+ 1
- 2
lodel/plugins/webui/interface/template/loader.py ファイルの表示

2
 import jinja2
2
 import jinja2
3
 import os
3
 import os
4
 
4
 
5
-from lodel.context import LodelContext
6
-LodelContext.expose_modules(globals(), {'lodel.settings': ['Settings']})
5
+from lodel.settings import Settings
7
 LodelContext.expose_dyncode(globals())
6
 LodelContext.expose_dyncode(globals())
8
 
7
 
9
 from ...client import WebUiClient as WebUiClient
8
 from ...client import WebUiClient as WebUiClient

+ 2
- 4
lodel/plugins/webui/main.py ファイルの表示

4
 import sys
4
 import sys
5
 import shlex
5
 import shlex
6
 
6
 
7
-from lodel.context import LodelContext
8
-LodelContext.expose_modules(globals(), {
9
-    'lodel.plugin': ['LodelHook'],
10
-    'lodel.settings': ['Settings']})
7
+from lodel.plugin import LodelHook
8
+from lodel.settings import Settings
11
 
9
 
12
 from lodel import buildconf #<-- This one is common to the build
10
 from lodel import buildconf #<-- This one is common to the build
13
 
11
 

+ 4
- 10
lodel/plugins/webui/run.py ファイルの表示

1
-# -*- coding: utf-8 -*-
2
-from lodel.context import LodelContext
3
-
4
-if not LodelContext.is_initialized():
5
-    import loader # Lodel2 loader
1
+import loader # Lodel2 loader
6
 
2
 
7
 import os
3
 import os
8
 import hashlib
4
 import hashlib
11
 
7
 
12
 from werkzeug.wrappers import Response
8
 from werkzeug.wrappers import Response
13
 
9
 
14
-LodelContext.expose_modules(globals(), {
15
-    'lodel.settings': ['Settings'],
16
-    'lodel.logger': 'logger',
17
-    'lodel.auth.exceptions': ['ClientError', 'ClientAuthenticationFailure',
18
-        'ClientPermissionDenied', 'ClientAuthenticationError']})
10
+from lodel.settings import Settings
11
+from lodel.logger import logger
12
+from lodel.auth.exceptions import ClientError, ClientAuthenticationFailure, ClientPermissionDenied, ClientAuthenticationError
19
 
13
 
20
 from .interface.router import get_controller
14
 from .interface.router import get_controller
21
 from .interface.lodelrequest import LodelRequest
15
 from .interface.lodelrequest import LodelRequest

+ 1
- 3
lodel/settings/__init__.py ファイルの表示

33
 #   print("DEBUG MODE !")
33
 #   print("DEBUG MODE !")
34
 # </pre>
34
 # </pre>
35
 #
35
 #
36
-from lodel.context import LodelContext
37
-LodelContext.expose_modules(globals(), {
38
-    'lodel.settings.settings': [('SettingsRO', 'Settings')]})
36
+from lodel.settings.settings import SettingsRO, Settings
39
 
37
 

+ 5
- 10
lodel/settings/settings.py ファイルの表示

8
 import types  # for dynamic bindings
8
 import types  # for dynamic bindings
9
 from collections import namedtuple
9
 from collections import namedtuple
10
 
10
 
11
-from lodel.context import LodelContext
12
-
13
-LodelContext.expose_modules(globals(), {
14
-    'lodel.logger': 'logger',
15
-    'lodel.settings.utils': ['SettingsError', 'SettingsErrors'],
16
-    'lodel.validator.validator': ['Validator', 'LODEL2_CONF_SPECS',
17
-                                  'confspec_append'],
18
-    'lodel.settings.settings_loader': ['SettingsLoader']})
11
+from lodel.logger import logger
12
+from lodel.settings.utils import SettingsError, SettingsErrors
13
+from lodel.settings.settings_loader import SettingsLoader
14
+from lodel.validator.validator import Validator, LODEL2_CONF_SPECS, confspec_append
19
 
15
 
20
 
16
 
21
 ##  @package lodel.settings.settings Lodel2 settings module
17
 ##  @package lodel.settings.settings Lodel2 settings module
140
 
136
 
141
     # @brief This method handles Settings instance bootstraping
137
     # @brief This method handles Settings instance bootstraping
142
     def __bootstrap(self):
138
     def __bootstrap(self):
143
-        LodelContext.expose_modules(globals(), {
144
-            'lodel.plugin.plugins': ['Plugin', 'PluginError']})
139
+        from lodel.plugin.plugins import Plugin, PluginError
145
         logger.debug("Settings bootstraping")
140
         logger.debug("Settings bootstraping")
146
         if self.__conf_specs is None:
141
         if self.__conf_specs is None:
147
             lodel2_specs = LODEL2_CONF_SPECS
142
             lodel2_specs = LODEL2_CONF_SPECS

+ 4
- 6
lodel/settings/settings_loader.py ファイルの表示

4
 import glob
4
 import glob
5
 import copy
5
 import copy
6
 
6
 
7
-from lodel.context import LodelContext
8
-
9
 #  @package lodel.settings.settings_loader Lodel2 loader of configuration options
7
 #  @package lodel.settings.settings_loader Lodel2 loader of configuration options
10
 #
8
 #
11
 # From a filesystem directory, all ini files are loaded in a dict (key/value) for each option
9
 # From a filesystem directory, all ini files are loaded in a dict (key/value) for each option
12
 # The options are called one by one by lodel bootstrap, if one or more options remains 
10
 # The options are called one by one by lodel bootstrap, if one or more options remains 
13
 # then an exception is raised
11
 # then an exception is raised
14
 
12
 
15
-LodelContext.expose_modules(globals(), {
16
-    'lodel.logger': 'logger',
17
-    'lodel.settings.utils': ['SettingsError', 'SettingsErrors'],
18
-    'lodel.validator.validator': ['ValidationError']})
13
+from lodel.logger import logger
14
+from lodel.settings.utils import SettingsError, SettingsErrors
15
+from lodel.validator.validator import ValidationError
16
+
19
 
17
 
20
 ##@brief Merges and loads configuration files
18
 ##@brief Merges and loads configuration files
21
 class SettingsLoader(object):
19
 class SettingsLoader(object):

+ 6
- 12
lodel/validator/validator.py ファイルの表示

8
 import copy
8
 import copy
9
 from lodel.context import LodelContext
9
 from lodel.context import LodelContext
10
 
10
 
11
-
12
-LodelContext.expose_modules(globals(), {
13
-    'lodel.mlnamedobject.mlnamedobject': ['MlNamedObject'],
14
-    'lodel.exceptions': ['LodelException', 'LodelExceptions',
15
-                         'LodelFatalError', 'FieldValidationError']})
11
+from lodel.mlnamedobject.mlnamedobject import MlNamedObject
12
+from lodel.exceptions import LodelException, LodelExceptions, LodelFatalError, FieldValidationError
16
 
13
 
17
 
14
 
18
 ##
15
 ##
354
 #
351
 #
355
 # @todo modify the hardcoded dyncode import (it's a warning)
352
 # @todo modify the hardcoded dyncode import (it's a warning)
356
 def emfield_val(value):
353
 def emfield_val(value):
357
-    LodelContext.expose_modules(globals(),
358
-                                {'lodel.plugin.hooks': ['LodelHook']})
354
+    from lodel.plugin.hooks import LodelHook
359
     spl = value.split('.')
355
     spl = value.split('.')
360
     if len(spl) != 2:
356
     if len(spl) != 2:
361
         msg = "Expected a value in the form CLASSNAME.FIELDNAME but got : %s"
357
         msg = "Expected a value in the form CLASSNAME.FIELDNAME but got : %s"
383
 # Able to check that the value is a plugin and if it is of a specific type
379
 # Able to check that the value is a plugin and if it is of a specific type
384
 def plugin_validator(value, ptype=None):
380
 def plugin_validator(value, ptype=None):
385
     if value:
381
     if value:
386
-        LodelContext.expose_modules(globals(), {
387
-            'lodel.plugin.hooks': ['LodelHook']})
382
+        from lodel.plugin.hooks import LodelHook
388
         value = copy.copy(value)
383
         value = copy.copy(value)
389
 
384
 
390
         @LodelHook('lodel2_dyncode_bootstraped')
385
         @LodelHook('lodel2_dyncode_bootstraped')
391
         def plugin_type_checker(hookname, caller, payload):
386
         def plugin_type_checker(hookname, caller, payload):
392
-            LodelContext.expose_modules(globals(), {
393
-                'lodel.plugin.plugins': ['Plugin'],
394
-                'lodel.plugin.exceptions': ['PluginError']})
387
+            from lodel.plugin.plugins import Plugin
388
+            from lodel.plugin.exceptions import PluginError
395
             if value is None:
389
             if value is None:
396
                 return
390
                 return
397
             try:
391
             try:

+ 0
- 40
nocontext_tests.py ファイルの表示

1
-#-*- coding: utf-8 -*-
2
-
3
-# @brief Loader for tests which do not need an lodel installation
4
-#
5
-# Options
6
-################
7
-#
8
-# @note We can pass the path to a directory to write results file, nocontext_tests.log
9
-# It has to be at first, otherwise it will not be taken
10
-# and the default one, current directory, will be used.
11
-# The results are not displayed, only stored in nocontext_tests.log
12
-#
13
-# -f, --failfast
14
-#
15
-#    Stop the test run on the first error or failure.
16
-# -v --verbose
17
-#
18
-#   higher verbosity
19
-#
20
-#
21
-
22
-import sys
23
-import os
24
-import os.path
25
-import unittest
26
-
27
-
28
-loader = unittest.TestLoader()
29
-
30
-if ((len(sys.argv) > 1) and (sys.argv[1].startswith('-')) is False):
31
-    dpath = sys.argv[1]
32
-else:
33
-    dpath = '.'
34
-
35
-suite = loader.discover('tests', pattern='nc_test*.py')
36
-with open(dpath + '/nocontext_tests.log', 'w') as logfile:
37
-    unittest.TextTestRunner(
38
-        logfile,
39
-        failfast='-f' in sys.argv,
40
-        verbosity=2 if '-v' in sys.argv else 1).run(suite)

+ 0
- 1
plugins ファイルの表示

1
-lodel/plugins/

+ 7
- 15
progs/slim/install_model/loader.py ファイルの表示

27
     print(e)
27
     print(e)
28
     exit(1)
28
     exit(1)
29
 
29
 
30
-#Set context to MONOSITE
31
-from lodel.context import LodelContext
32
-LodelContext.init()
33
-
34
 if 'LODEL2_NO_SETTINGS_LOAD' not in os.environ:
30
 if 'LODEL2_NO_SETTINGS_LOAD' not in os.environ:
35
     #
31
     #
36
     # Loading settings
32
     # Loading settings
37
     #
33
     #
38
-    LodelContext.expose_modules(globals(), {
39
-        'lodel.settings.settings': [('Settings', 'settings')]})
34
+    from lodel.settings.settings import Settings, settings
40
     if not settings.started():
35
     if not settings.started():
41
         settings('conf.d')
36
         settings('conf.d')
42
-    LodelContext.expose_modules(globals(), {
43
-        'lodel.settings': ['Settings']})
37
+    from lodel.settings import Settings
44
     
38
     
45
     #Starts hooks
39
     #Starts hooks
46
-    LodelContext.expose_modules(globals(), {
47
-        'lodel.plugin': ['LodelHook'],
48
-	'lodel.plugin.core_hooks': 'core_hooks',
49
-	'lodel.plugin.core_scripts': 'core_scripts'})
40
+    from lodel.plugin import LodelHook
41
+	from lodel.plugin.core_hooks import core_hooks
42
+	from lodel.plugin.core_scripts import core_scripts
50
 
43
 
51
 def start():
44
 def start():
52
     #Load plugins
45
     #Load plugins
53
-    LodelContext.expose_modules(globals(), {
54
-        'lodel.logger': 'logger',
55
-        'lodel.plugin': ['Plugin']})
46
+    from lodel.logger import logger
47
+    from lodel.plugin import Plugin
56
     logger.debug("Loader.start() called")
48
     logger.debug("Loader.start() called")
57
     Plugin.load_all()
49
     Plugin.load_all()
58
     LodelHook.call_hook('lodel2_bootstraped', '__main__', None)
50
     LodelHook.call_hook('lodel2_bootstraped', '__main__', None)

読み込み中…
キャンセル
保存