django-orchestra/orchestra/contrib/settings
Santiago L f8dd7c8775 Update code using django-upgrade (target 3.2)
git ls-files -z -- '*.py' | xargs -0 django-upgrade --target-version 3.2
2024-01-26 14:05:02 +01:00
..
templates/admin/settings inicio 2023/07/09 2023-11-26 09:52:02 +00:00
README.md Improved settings.parser API 2015-10-04 19:57:00 +00:00
__init__.py Update code using django-upgrade (target 3.2) 2024-01-26 14:05:02 +01:00
admin.py inicio 2023/07/09 2023-11-26 09:52:02 +00:00
apps.py inicio 2023/07/09 2023-11-26 09:52:02 +00:00
forms.py inicio 2023/07/09 2023-11-26 09:52:02 +00:00
parser.py inicio 2023/07/09 2023-11-26 09:52:02 +00:00

README.md

>>> from orchestra.contrib.settings import Setting, parser
>>> Setting.settings['TASKS_BACKEND'].value
'thread'
>>> Setting.settings['TASKS_BACKEND'].default
'thread'
>>> Setting.settings['TASKS_BACKEND'].validate_value('rata')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/orchestra/django-orchestra/orchestra/contrib/settings/__init__.py", line 99, in validate_value
    raise ValidationError("'%s' not in '%s'" % (value, ', '.join(choices)))
django.core.exceptions.ValidationError: ["'rata' not in 'thread, process, celery'"]
>>> parser.apply({'TASKS_BACKEND': 'process'})
...
>>> parser.apply({'TASKS_BACKEND': parser.Remove()})
...