No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

__init__.py 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. ##@brief Plugin designed to handle FS site creation
  2. #
  3. #This plugin has a strong coupling with the multisite EM. It is
  4. #designed to handle only 1 EmClass : Lodelsite .
  5. #This class must have some mandatory fields :
  6. # - shortname
  7. # - extensions : list of loaded plugins
  8. # - em_groups : selected Em Group from base Em
  9. #
  10. # Every other fields are ignored by this datasource and forwarded to
  11. #childs datasource.
  12. from lodel.context import LodelContext
  13. LodelContext.expose_modules(globals(), {
  14. 'lodel.settings.validator': ['SettingValidator'],
  15. 'lodel.logger': 'logger'})
  16. from .datasource import DummyDatasource as Datasource
  17. from .specs import check
  18. __plugin_type__ = 'datasource'
  19. __plugin_name__ = "lodelsite_datasource"
  20. __version__ = '0.0.1'
  21. __loader__ = 'main.py'
  22. __plugin_deps__ = []
  23. CONFSPEC = {
  24. 'lodel2.datasource.lodelsite_datasource.*' : {
  25. 'db_datasource': ( None,
  26. SettingValidator('string')),
  27. 'db_datasource_ro': (None,
  28. SettingValidator('string', none_is_valid = True)),
  29. }
  30. }
  31. ##@brief Hardcoded checks that try to know if the EM fits the requierements
  32. def _activate():
  33. import leapi_dyncode
  34. if 'Lodelsite' not in leapi_dyncode.dynclasses_dict:
  35. logger.fatal('Unable to activate lodelsite_datasource. Expected a \
  36. Lodelsite leapi object')
  37. return False #or raise ?
  38. LodelSite = leapi_dyncode.dynclasses_dict['Lodelsite']
  39. res, reason = check(LodelSite)
  40. if not res:
  41. logger.fatal('The lodelsite EmClass has some missins mandatory \
  42. fields : '+reason)
  43. return res