validator.py 411B

123456789101112
  1. from marshmallow.validate import OneOf
  2. from tracim_backend.app_models.contents import CONTENT_TYPES
  3. # TODO - G.M - 2018-08-08 - [GlobalVar] Refactor Global var
  4. # of tracim_backend, Be careful ALL_CONTENT_TYPES_VALIDATOR is a global_var !
  5. ALL_CONTENT_TYPES_VALIDATOR = OneOf(choices=[])
  6. def update_validators():
  7. ALL_CONTENT_TYPES_VALIDATOR.choices = CONTENT_TYPES.endpoint_allowed_types_slug() # nopep8