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.6KB

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