Açıklama Yok
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.

confspec.py 2.5KB

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