Initialize the global context for the request.
(self, body: CallbackExecutionBody)
| 1514 | |
| 1515 | # pylint: disable=R0915 |
| 1516 | def _initialize_context(self, body: CallbackExecutionBody): |
| 1517 | """Initialize the global context for the request.""" |
| 1518 | adapter = self.backend.request_adapter() |
| 1519 | g = AttributeDict({}) |
| 1520 | g.inputs_list = body.get("inputs", []) |
| 1521 | g.states_list = body.get("state", []) |
| 1522 | g.outputs_list = body.get("outputs", []) |
| 1523 | g.input_values = inputs_to_dict(g.inputs_list) |
| 1524 | g.state_values = inputs_to_dict(g.states_list) |
| 1525 | g.triggered_inputs = [ |
| 1526 | {"prop_id": x, "value": g.input_values.get(x)} |
| 1527 | for x in body.get("changedPropIds", []) |
| 1528 | ] |
| 1529 | g.dash_response = self.backend.response_adapter() |
| 1530 | g.cookies = dict(adapter.cookies) |
| 1531 | g.headers = dict(adapter.headers) |
| 1532 | g.args = adapter.args |
| 1533 | g.path = adapter.full_path |
| 1534 | g.remote = adapter.remote_addr |
| 1535 | g.origin = adapter.origin |
| 1536 | g.updated_props = {} |
| 1537 | return g |
| 1538 | |
| 1539 | def _prepare_callback(self, g, body: CallbackExecutionBody): |
| 1540 | """Prepare callback-related data.""" |
no test coverage detected