betty.attrs.optional module

Optional attributes.

final class betty.attrs.optional.Optional

Bases: ProxyProp[OwnerT, GetT | None, SetT | None], SettableAttr[OwnerT, GetT | None, SetT | None], Generic

Make another attribute optional, e.g. allow None.

__init__(proxied: SettableAttr[OwnerT, GetT, SetT], /)
delete(owner: OwnerT, /) None

Delete the property value from the owner.

Raises:

NotDeletable

get(owner: OwnerT, /) GetT | None

Get the property value from the owner.

init_owner(owner: OwnerT, /) None

Initialize the property on an owner.

set(owner: OwnerT, value: SetT | None, /) None

Set the property value on the owner.

Raises:

NotSettable