Field values
When you query a value you always specify whether that value is optional or required:
>>> document.field('default_settings').required_string_value()
>>> document.field('extra_settings').optional_string_value()
The optional_*
query returns a value or None
, while the required_*
query
raises a validation error if the value is missing, such as:
The field 'default_settings' must contain a value.
Line | Content
> 1 | default_settings:
Fieldset entry values
This works just like on a field:
>>> document.fieldset('image').entry('src').required_string_value()
>>> document.fieldset('image').entry('title').optional_string_value()
Next page: List values