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

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