Skip to content

Commit 70a10c3

Browse files
delsimGibbsConsulting
authored andcommitted
Change handling of json response due to underlying library change (#146)
* Change handling of json response due to underlying library change
1 parent 701df95 commit 70a10c3

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

django_plotly_dash/dash_wrapper.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,14 @@ def dispatch_with_args(self, body, argMap):
462462
state = body.get('state', [])
463463
output = body['output']
464464

465-
target_id = '{}.{}'.format(output['id'], output['property'])
465+
try:
466+
output_id = output['id']
467+
output_property = output['property']
468+
target_id = "%s.%s" %(output_id, output_property)
469+
except:
470+
target_id = output
471+
output_id, output_property = output.split(".")
472+
466473
args = []
467474

468475
da = argMap.get('dash_app', None)
@@ -491,10 +498,10 @@ def dispatch_with_args(self, body, argMap):
491498
return 'EDGECASEEXIT'
492499

493500
res = self.callback_map[target_id]['callback'](*args, **argMap)
494-
if da and da.have_current_state_entry(output['id'], output['property']):
501+
if da and da.have_current_state_entry(output_id, output_property):
495502
response = json.loads(res.data.decode('utf-8'))
496-
value = response.get('response', {}).get('props', {}).get(output['property'], None)
497-
da.update_current_state(output['id'], output['property'], value)
503+
value = response.get('response', {}).get('props', {}).get(output_property, None)
504+
da.update_current_state(output_id, output_property, value)
498505

499506
return res
500507

0 commit comments

Comments
 (0)