Section ยป enforce_all_elements

enforce_all_elements
enforce_all_elements(enforce)

Set the default for all following queries on this section of whether the presence of elements in the eno input text should be enforced (by default it is not). This can be used to prevent "template decay" - with presence enforcement enabled elements may be empty, but they (at least their declaration) must be there in the eno text and consequently they can not disappear from a template over time without triggering an error.

enocolor: blue
python>>> document = enopy.parse(input)
>>> document.field('sound')
None

>>> document.enforce_all_elements()

>>> document.field('sound')
ValidationError: ...
>>> document.field('sound', enforce_element=False)
None

Parameters

enforce

An optional boolean indicating whether to enforce or not. (otherwise True is assumed)