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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #
  2. # This file is part of Lodel 2 (https://github.com/OpenEdition)
  3. #
  4. # Copyright (C) 2015-2017 Cléo UMS-3287
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU Affero General Public License as published
  8. # by the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU Affero General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU Affero General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. from lodel.leapi.datahandlers.base_classes import DataHandler
  20. DataHandler.load_base_handlers()
  21. ## @defgroup lodel2_datahandlers Datahandlers
  22. # @ingroup lodel2_leapi
  23. # @ingroup lodel2_em
  24. ## @defgroup lodel2_dh_checks Datahandlers datas checking
  25. # @ingroup lodel2_datahandlers
  26. ## @package lodel.leapi.datahandlers Lodel2 datahandlers
  27. #
  28. # Datahandlers are object that handles datas check, construction and
  29. # consistency check
  30. #
  31. ## @page lodel2_dh_checks_page Datahandlers datas checking
  32. # @ingroup lodel2_dh_checks
  33. #
  34. # @section lodel2_dh_check_mech Datas checking mechanism
  35. #
  36. # The data checking mechanism is divided into 3 stages :
  37. # 1. **value checking** : a basic value check. Example : is len(value) < 52 ?
  38. # 2. **data construction** : for data that needs to be modified. Example :
  39. # a date that will be transformed into a Datetime object associated with a
  40. # timezone
  41. # 3. **data consistency checking** : performs a consistency checking on the
  42. # object from the "point of view" of the current field. Example : is the
  43. # given lodel_id an identifier of an Article ?
  44. #
  45. # @subsection lodel2_dh_check_impl Implementation
  46. #
  47. # Those three stages are implemented by 3 datahandlers methods :
  48. # - @ref base_classes.DataHandler.check_data_value() "check_data_value"
  49. # - @ref base_classes.DataHandler.construct_data() "construct_data"
  50. # - @ref base_classes.DataHandler.check_data_value() "check_data_consitency"
  51. #
  52. # @note To ensure the calls of the base classes methods child classes implements
  53. # those method with a '_' prefix :
  54. # - @ref base_classes.DataHandler._check_data_value "_check_data_value()"
  55. # - @ref base_classes.DataHandler._construct_data() "_construct_data"
  56. # - @ref base_classes.DataHandler._check_data_value() "_check_data_consitency"
  57. #
  58. # Examples of child classes can be found @ref datahandlers.datas "here"
  59. #
  60. # @subsubsection lodel2_dh_datas_construction Datas construction
  61. #
  62. # When constructing a data handled by a datahandler we may need to have access
  63. # to other datas in the object (see @ref base_classes.DataHandler.construct_data() "construct_data() arguments").
  64. #
  65. # The problem resides in the construction order, if we need other data we have
  66. # to be sure that they are already constructed. To achieve this goal the data
  67. # dictionary given as arguement to @ref base_classes.DataHandler.construct_data() "construct_data()"
  68. # is a @ref base_classes.DatasConstructor "DatasConstructor" instance. This class
  69. # checks if a data is constructed when trying to access it, if not it runs
  70. # the corresponding construct_data() (and have a circular dependencies detection
  71. # mechanism)
  72. #
  73. #@see base_classes.DatasConstructor.