Skip to content

Documentfield

yex.control.documentfield #

DocumentField(value=None, **kwargs) #

Bases: yex.control.parameter.Parameter

A reference to a field in a Document instance.

This allows doc[...] to access the field using subscripting like any other control, rather than having to special-case it.

Source code in yex/control/parameter.py
75
76
77
78
79
80
81
82
83
84
85
86
87
88
def __init__(self, value=None, **kwargs):

    super().__init__(**kwargs)

    if value is not None:
        self._value = value
    elif self.do_not_initialise:
        pass
    elif isinstance(self.initial_value, self.our_type):
        self._value = self.initial_value
    elif isinstance(self.our_type, tuple):
        self._value = self.our_type[0](self.initial_value)
    else:
        self._value = self.our_type(self.initial_value)

fieldname property #

The name of the field in Document we represent.

Not our own name in the controls table: there should be no leading underscore.