Variable#

class lumen.variables.base.Variable(*, default, label, materialize, required, secure, value, name)#

Variable components declare values that can be referenced from other components.

The source of the Variable value can be anything from an environment variable to a widget or URL parameter. Variable components allow a concise way to configure other components and make it possible to orchestrate actions across multiple components.


Parameters#

default

type: Any
default: None
Default value to use if no other value is defined

label

type: str
default: None
Optional label override for variable. Used wherever the variableshows up in the UI.

materialize

type: bool
default: False
Whether the variable should be inlined as a constant variable(in the Lumen Builder).

name

type: str
default: 'Variable'
String identifier for this object.

required

type: bool
default: False
Whether the variable should be treated as required.

secure

type: bool
default: False
Whether the variable should be treated as secure.

value

type: Any
default: None
The materialized value of the variable.


Methods#

Variable.as_materialized() Constant#

If the variable is to be materialized by the builder this implements the conversion from a variable that references some external value to a materialized value.

Variable.to_spec(context: Dict[str, Any] | None = None) Dict[str, Any]#

Exports the full specification to reconstruct this component.

Return type:

Resolved and instantiated Component object

Types#

Constant type: constant

Constant declares a constant value that can be referenced.

EnvVariable type: env

EnvVariable fetches an environment variable that can be referenced.

Widget type: widget

Widget variables dynamically reflect the current widget value.

Parameter type: param

Parameter variables reflect the current value of a parameter.

URLQuery type: url

URLQuery variables reflect the value of a URL query parameter.

Cookie type: cookie

Cookie variables reflect the value of a cookie in the request.

UserInfo type: user

UserInfo variables reflect a value in the user info returned by an OAuth provider.

Header type: header

Header variables reflect the value of a request header.