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 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. from lodel.settings.validator import SettingValidator
  2. from .datasource import DummyDatasource as Datasource
  3. __plugin_type__ = 'datasource'
  4. __plugin_name__ = "dummy_datasource"
  5. __version__ = '0.0.1'
  6. __loader__ = 'main.py'
  7. __plugin_deps__ = []
  8. CONFSPEC = {
  9. 'lodel2.datasource.dummy_datasource.*' : {
  10. 'dummy': ( None,
  11. SettingValidator('dummy'))}
  12. }
  13. ##@page lodel2_datasources Lodel2 datasources
  14. #
  15. #@par lodel2_datasources_intro Intro
  16. # A single lodel2 website can interact with multiple datasources. This page
  17. # aims to describe configuration & organisation of datasources in lodel2.
  18. # Each object is attached to a datasource. This association is done in the
  19. # editorial model, the datasource is identified by a name.
  20. #
  21. #@par Datasources declaration
  22. # To define a datasource you have to write something like this in confs file :
  23. #<pre>
  24. #[lodel2.datasources.DATASOURCE_NAME]
  25. #identifier = DATASOURCE_FAMILY.SOURCE_NAME
  26. #</pre>
  27. # See below for DATASOURCE_FAMILY & SOURCE_NAME
  28. #
  29. #@par Datasources plugins
  30. # Each datasource family is a plugin. For example mysql or a mongodb plugins.
  31. # Here is the CONFSPEC variable templates for datasources plugins
  32. #<pre>
  33. #CONFSPEC = {
  34. # 'lodel2.datasource.example.*' : {
  35. # 'conf1' : VALIDATOR_OPTS,
  36. # 'conf2' : VALIDATOR_OPTS,
  37. # ...
  38. # }
  39. #}
  40. #</pre>
  41. #MySQL example
  42. #<pre>
  43. #CONFSPEC = {
  44. # 'lodel2.datasource.mysql.*' : {
  45. # 'host': ( 'localhost',
  46. # SettingValidator('host')),
  47. # 'db_name': ( 'lodel',
  48. # SettingValidator('string')),
  49. # 'username': ( None,
  50. # SettingValidator('string')),
  51. # 'password': ( None,
  52. # SettingValidator('string')),
  53. # }
  54. #}
  55. #</pre>
  56. #
  57. #@par Configuration example
  58. #<pre>
  59. # [lodel2.datasources.main]
  60. # identifier = mysql.Core
  61. # [lodel2.datasources.revues_write]
  62. # identifier = mysql.Revues
  63. # [lodel2.datasources.revues_read]
  64. # identifier = mysql.Revues
  65. # [lodel2.datasources.annuaire_persons]
  66. # identifier = persons_web_api.example
  67. # ;
  68. # ; Then, in the editorial model you are able to use "main", "revues_write",
  69. # ; etc as datasource
  70. # ;
  71. # ; Here comes the datasources declarations
  72. # [lodel2.datasource.mysql.Core]
  73. # host = db.core.labocleo.org
  74. # db_name = core
  75. # username = foo
  76. # password = bar
  77. # ;
  78. # [lodel2.datasource.mysql.Revues]
  79. # host = revues.org
  80. # db_name = RO
  81. # username = foo
  82. # password = bar
  83. # ;
  84. # [lodel2.datasource.persons_web_api.example]
  85. # host = foo.bar
  86. # username = cleo
  87. #</pre>