Skip to content

Commit ef420a4

Browse files
committed
🔨 Rename callback->callback_context
1 parent a239f7a commit ef420a4

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

Diff for: dash/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
from .version import __version__ # noqa: F401
77
from ._callback_context import CallbackContext as _CallbackContext
88

9-
callback = _CallbackContext()
9+
callback_context = _CallbackContext()

Diff for: dash/dash.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ def dispatch(self):
958958
'{}.{}'.format(x['id'], x['property']): x.get('value')
959959
for x in state
960960
}
961-
flask.g.triggered_inputs = body.get('changedProps')
961+
flask.g.triggered_inputs = body.get('changedPropIds')
962962

963963
for component_registration in self.callback_map[target_id]['inputs']:
964964
args.append([

Diff for: tests/test_integration.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -589,11 +589,10 @@ def test_callback_context(self):
589589
@app.callback(Output('output', 'children'),
590590
[Input(x, 'n_clicks') for x in btns])
591591
def on_click(*args):
592-
print('wtf')
593-
if not dash.callback.triggered:
592+
if not dash.callback_context.triggered:
594593
raise PreventUpdate
595-
trigger = dash.callback.triggered[0]
596-
input_value = dash.callback.inputs.get(trigger)
594+
trigger = dash.callback_context.triggered[0]
595+
input_value = dash.callback_context.inputs.get(trigger)
597596
return 'Just clicked {} for the {} time!'.format(
598597
trigger.split('.')[0], input_value
599598
)
@@ -616,4 +615,4 @@ def on_click(*args):
616615

617616
def test_no_callback_context(self):
618617
with self.assertRaises(MissingCallbackContextException):
619-
no_context = dash.callback.inputs
618+
no_context = dash.callback_context.inputs

0 commit comments

Comments
 (0)