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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 .specs import check
  17. __plugin_type__ = 'datasource'
  18. __plugin_name__ = "lodelsite_datasource"
  19. __version__ = '0.0.1'
  20. __loader__ = 'main.py'
  21. __plugin_deps__ = []
  22. CONFSPEC = {
  23. 'lodel2.datasource.lodelsite_datasource.*' : {
  24. 'db_datasource': ( None,
  25. SettingValidator('string')),
  26. 'db_datasource_ro': (None,
  27. SettingValidator('string', none_is_valid = True)),
  28. }
  29. }
  30. ##@brief Hardcoded checks that try to know if the EM fits the requierements
  31. def _activate():
  32. import leapi_dyncode
  33. if 'Lodelsite' not in leapi_dyncode.dynclasses_dict:
  34. logger.fatal('Unable to activate lodelsite_datasource. Expected a \
  35. Lodelsite leapi object')
  36. return False #or raise ?
  37. LodelSite = leapi_dyncode.dynclasses_dict['Lodelsite']
  38. res, reason = check(LodelSite)
  39. if not res:
  40. logger.fatal('The lodelsite EmClass has some missins mandatory \
  41. fields : '+reason)
  42. return res